Logical bug in JavaUtilLog

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Logical bug in JavaUtilLog

Lothar Kimmeringer
Hi,

I think that there is a bug in JavaUtilLog:

public class JavaUtilLog extends AbstractLogger
[...]
    public JavaUtilLog(String name)
    {
        _logger = java.util.logging.Logger.getLogger(name);
        if (Boolean.parseBoolean(Log.__props.getProperty("org.eclipse.jetty.util.log.DEBUG", "false")))
        {
            _logger.setLevel(Level.FINE);
        }
        configuredLevel = _logger.getLevel();
    }
[...]
    public void setDebugEnabled(boolean enabled)
    {
        if (enabled)
        {
            configuredLevel = _logger.getLevel();
            _logger.setLevel(Level.FINE);
        }
        else
        {
            _logger.setLevel(configuredLevel);
        }
    }
[...]
}

I think configuredLevel should be instantiated before
the system property is evaluated. With the system-
property being set it's impossible to return to
non-debug-logging during runtime.


Thanks and cheers, Lothar
_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users
Reply | Threaded
Open this post in threaded view
|

Re: Logical bug in JavaUtilLog

Joakim Erdfelt-8
The behavior of org.eclipse.jetty.util.log.DEBUG is consistent with all of the other logging layers Jetty supports.
Its set to enable DEBUG for the lifetime of the VM.

Don't use that System property if you want to adjust levels at runtime.

Joakim Erdfelt / [hidden email]

On Fri, Feb 5, 2016 at 7:41 AM, Lothar Kimmeringer <[hidden email]> wrote:
Hi,

I think that there is a bug in JavaUtilLog:

public class JavaUtilLog extends AbstractLogger
[...]
    public JavaUtilLog(String name)
    {
        _logger = java.util.logging.Logger.getLogger(name);
        if (Boolean.parseBoolean(Log.__props.getProperty("org.eclipse.jetty.util.log.DEBUG", "false")))
        {
            _logger.setLevel(Level.FINE);
        }
        configuredLevel = _logger.getLevel();
    }
[...]
    public void setDebugEnabled(boolean enabled)
    {
        if (enabled)
        {
            configuredLevel = _logger.getLevel();
            _logger.setLevel(Level.FINE);
        }
        else
        {
            _logger.setLevel(configuredLevel);
        }
    }
[...]
}

I think configuredLevel should be instantiated before
the system property is evaluated. With the system-
property being set it's impossible to return to
non-debug-logging during runtime.


Thanks and cheers, Lothar
_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users
Reply | Threaded
Open this post in threaded view
|

Re: Logical bug in JavaUtilLog

Lothar Kimmeringer
Am 05.02.2016 um 15:45 schrieb Joakim Erdfelt:
> The behavior of org.eclipse.jetty.util.log.DEBUG is consistent
> with all of the other logging layers Jetty supports.
> Its set to enable DEBUG for the lifetime of the VM.
>
> Don't use that System property if you want to adjust levels at runtime.

I expected this kind of answer so my solution was to set the
variable using reflection before calling setDebugEnabled(false),
since it's not always possible to just restart a production
server just because it's been accidently started with the
property leading to gigabytes of logs filling up the hard drive.


Cheers, Lothar
_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users