PDA

View Full Version : SC7 logging



Neil Sleightholm
2007-11-20, 15:24
Is there any documentation on the new logging in v7? The settings page seems to imply that it will remember what level the logging is set to the next time the server is started but the AlienBBC plugin seems to just go back to its default value. I have seen that a few other plugins use a syntax like this to enable the developer to set the logging level:

my $log = Slim::Utils::Log->addLogCategory({
'category' => 'plugin.alienbbc',
'defaultLevel' => $ENV{ALIEN_DEV} ? 'DEBUG' : 'WARN',
'description' => getDisplayName(),
});

(E.g. if the environment variable ALIEN_DEV is set use DEBUG else WARN).

Is this the preferred way or is there a method of setting and remembering the log level? It used to be possible to set it at the command line but this doesn't seem to be possible now.

Thanks, Neil

Mark Miksis
2007-11-20, 15:28
it's part of this bug: http://forums.slimdevices.com/showthread.php?t=40423

Triode
2007-11-20, 15:30
I don't think it will be persitent, but you can set the logging level from
the command line when you start:

../slimserver.pl --debug plugin.alienbbc

Will start in debug mode.

[change for windows equivalent!]

----- Original Message -----
From: "Neil Sleightholm"
<Neil.Sleightholm.30dbbn1195597501 (AT) no-mx (DOT) forums.slimdevices.com>
To: <developers (AT) lists (DOT) slimdevices.com>
Sent: Tuesday, November 20, 2007 10:24 PM
Subject: [Developers] SC7 logging


>
> Is there any documentation on the new logging in v7? The settings page
> seems to imply that it will remember what level the logging is set to
> the next time the server is started but the AlienBBC plugin seems to
> just go back to its default value. I have seen that a few other plugins
> use a syntax like this to enable the developer to set the logging
> level:
>
> my $log = Slim::Utils::Log->addLogCategory({
> 'category' => 'plugin.alienbbc',
> 'defaultLevel' => $ENV{ALIEN_DEV} ? 'DEBUG' : 'WARN',
> 'description' => getDisplayName(),
> });
>
> (E.g. if the environment variable ALIEN_DEV is set use DEBUG else
> WARN).
>
> Is this the preferred way or is there a method of setting and
> remembering the log level? It used to be possible to set it at the
> command line but this doesn't seem to be possible now.
>
> Thanks, Neil
>
>
> --
> Neil Sleightholm
> ------------------------------------------------------------------------
> Neil Sleightholm's Profile:
> http://forums.slimdevices.com/member.php?userid=131
> View this thread: http://forums.slimdevices.com/showthread.php?t=40423
>
>

Triode
2007-11-20, 15:33
What's the bug - lets fix that rather than making plugins look for environment vars...

Neil Sleightholm
2007-11-20, 15:50
it's part of this bug: http://forums.slimdevices.com/showthread.php?t=40423This link points at this post!

bpa
2007-11-20, 15:52
For user installed plugins changes in the logging level is not remembered between restart of the SC even if the "remember setting" check box is ticked.

This bug was noted a few months ago but I think it was only fixed for SC plugins.

Mark Miksis
2007-11-20, 15:57
This link points at this post!

Heh. http://bugs.slimdevices.com/show_bug.cgi?id=5607

Philip Meyer
2007-11-20, 15:57
I noticed similar issues with log settings being lost on restart. Seems to go wrong for plugins, generally.

Plugins that I have noticed losing their logging level are:

"(plugin.lastfm) - LastFM" - resets to Debug level
"(plugin.lazysearch2) - Lazy Search Music" - resets to Info level
"(plugin.musicinfoscr) - Music Information Screen" - resets to Error level
"(plugin.scrobbler) - LastFM / SqueezeScrobbler" - resets to Debug level

Phil

Neil Sleightholm
2007-11-20, 16:01
This bug seems to imply that it is purely a display issue, I need to test it some more but I think the setting it lost.

Neil

Triode
2007-11-20, 16:24
So does this work for people:

diff -dur trunk/server/Slim/Utils/Log.pm Slim/Utils/Log.pm
--- trunk/server/Slim/Utils/Log.pm 2007-10-21 21:33:32.000000000 +0100
+++ Slim/Utils/Log.pm 2007-11-20 23:20:20.000000000 +0000
@@ -329,7 +329,7 @@
if (my $category = $args->{'category'}) {

$class->setLogLevelForCategory(
- $category, ($debugLine{$category} ||
$args->{'defaultLevel'} || 'WARN'),
+ $category, ($debugLine{$category} ||
$runningConfig{"log4perl.logger.$category"} || $args->{'defaultLevel'} ||
'WARN'),
);

if (my $desc = $args->{'description'}) {

----- Original Message -----
From: "Fletch" <Fletch.30dcxz1195599601 (AT) no-mx (DOT) forums.slimdevices.com>
To: <developers (AT) lists (DOT) slimdevices.com>
Sent: Tuesday, November 20, 2007 10:57 PM
Subject: Re: [Developers] SC7 logging


>
> Neil Sleightholm;244197 Wrote:
>> This link points at this post!
>
> Heh. http://bugs.slimdevices.com/show_bug.cgi?id=5607
>
>
> --
> Fletch
> ------------------------------------------------------------------------
> Fletch's Profile: http://forums.slimdevices.com/member.php?userid=529
> View this thread: http://forums.slimdevices.com/showthread.php?t=40423
>
>

Triode
2007-11-20, 16:51
Looks like the mail to forum gateway is running slow.

I checked my proposed change in as r14884.

Neil Sleightholm
2007-11-21, 15:31
That works for me.

The only thing I noticed was that the "Save logging settings for use at next application restart" setting is not retained so you have to set it every time you change the logging level.

Neil

Mark Miksis
2007-11-21, 22:39
The only thing I noticed was that the "Save logging settings for use at next application restart" setting is not retained so you have to set it every time you change the logging level.

Yeah, I would prefer this:
- Make "save settings after restart" the default
- Remove the "save settings" option checkbox
- Add a button to "restore default logging settings"

mherger
2007-11-21, 23:20
> Yeah, I would prefer this:
> - Make "save settings after restart" the default
> - Remove the "save settings" option checkbox
> - Add a button to "restore default logging settings"

Please update the following enhancement request:
http://bugs.slimdevices.com/show_bug.cgi?id=6020

Michael

Triode
2007-11-22, 13:26
>
> Neil Sleightholm;244479 Wrote:
>> The only thing I noticed was that the -"Save logging settings for use at
>> next application restart"- setting is not retained so you have to set it
>> every time you change the logging level.
>
> Yeah, I would prefer this:
> - Make "save settings after restart" the default
> - Remove the "save settings" option checkbox
> - Add a button to "restore default logging settings"
>

I'd pefer it the other way (as not) so that when I start the server with
command line options to debug something this does not get saved.

Perhaps the best solution would be to keep the checkbox but make it a
preference which persits so we can have either way of working?

Neil Sleightholm
2007-11-22, 14:27
I'd pefer it the other way (as not) so that when I start the server with
command line options to debug something this does not get saved.

Perhaps the best solution would be to keep the checkbox but make it a
preference which persits so we can have either way of working?I would agree with this. It is a checkbox so I would assume it would retain it's state, it currently behaves like a button in combination with the save link.

kdf
2007-11-22, 14:31
Dare I say it...but what about keeping checkbox state but command line args are only that session unless you add the --persist?

-k