Suppress or redirect Logback's internal status messages?

How can I configure Logback to suppress all of its internal status console messages or redirect these to standard output or a file? 16:50:25,814 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml] 16:50:25,814 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/opt/dap/domains/ap0491/uat1/domain/instance-config/logback.xml] 16:50:25,816 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs multiple times on the classpath. 16:50:25,816 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs at [file:/opt/dap/domains/ap0491/uat1/domain/instance-config/logback.xml] 16:50:25,816 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs at [file:/opt/dap/domains/ap0491/uat1/domain/instance-config/logback.xml] 16:50:25,923 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set 16:50:25,924 |-INFO in ch.qos.logback.classic.turbo.ReconfigureOnChangeFilter@1a15291 - Will scan for changes in file [/opt/dap/domains/ap0491/uat1/domain/instance-config/logback.xml] every 60 seconds. ... Thank you, Derek

Logback only outputs its status messages when there is a warning or error - in this case Logback thinks that you have two logback.xml files on the classpath. As they have the same path, it looks like Logback is wrong. Are you using WebLogic? There was a similar issue with SLF4J wrongly thinking there were multiple bindings on the classpath. ----- Original Message ----- From: "Derek Mahar" <derek.mahar@gmail.com> To: logback-user@qos.ch Sent: Wednesday, 4 August, 2010 4:26:06 PM Subject: [logback-user] Suppress or redirect Logback's internal status messages? How can I configure Logback to suppress all of its internal status console messages or redirect these to standard output or a file? 16:50:25,814 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml] 16:50:25,814 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/opt/dap/domains/ap0491/uat1/domain/instance-config/logback.xml] 16:50:25,816 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs multiple times on the classpath. 16:50:25,816 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs at [file:/opt/dap/domains/ap0491/uat1/domain/instance-config/logback.xml] 16:50:25,816 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs at [file:/opt/dap/domains/ap0491/uat1/domain/instance-config/logback.xml] 16:50:25,923 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set 16:50:25,924 |-INFO in ch.qos.logback.classic.turbo.ReconfigureOnChangeFilter@1a15291 - Will scan for changes in file [/opt/dap/domains/ap0491/uat1/domain/instance-config/logback.xml] every 60 seconds. ... Thank you, Derek _______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user

Yes, I'm using WebLogic server. Are you suggesting that SLF4J is loading and configuring Logback twice? If this were the case, wouldn't I see duplicates of all of Logback's status messages? Do you know how I can fix this problem? Derek On Wed, Aug 4, 2010 at 12:11 PM, Robert Elliot <rob@lidalia.org.uk> wrote:
Logback only outputs its status messages when there is a warning or error - in this case Logback thinks that you have two logback.xml files on the classpath. As they have the same path, it looks like Logback is wrong.
Are you using WebLogic? There was a similar issue with SLF4J wrongly thinking there were multiple bindings on the classpath.

Logback is incorrectly trying to warn you that you have placed two logback.xml files on the classpath. (It does this because if you had (you haven't) it would be a deployment error, as you might get random behaviour if the configuration files were different depending on which got loaded first.) However, the log you posted shows that in fact the "two" files are the same file. This is a feature (bug?) of the WebLogic classloader - when you request resources it sometimes returns the same resource twice. This leads Logback to warn you (wrongly) that you have provided two different versions of the file. I personally believe Logback and SLF4J should simply fix this by using a Set rather than any other Collection to check for duplicates; partly because I am not sure it is actually a bug (the contract of ClassLoader.getResources does not actually state that the Enumeration<URL> it returns should contain no duplicates) and partly because I see no good reason not to. You could raise a bug here: http://jira.qos.ch/secure/BrowseProject.jspa - I can't find one already. However, the corresponding bug in SLF4J (http://bugzilla.slf4j.org/show_bug.cgi?id=138) isn't getting a lot of love. I believe there is no way to suppress Logback warnings. So short of forking Logback or moving off WebLogic I'm not sure there's much you can do unless it gets fixed in a later version of Logback/Weblogic. ----- Original Message ----- From: "Derek Mahar" <derek.mahar@gmail.com> To: "logback users list" <logback-user@qos.ch> Sent: Wednesday, 4 August, 2010 5:29:58 PM Subject: Re: [logback-user] Suppress or redirect Logback's internal status messages? Yes, I'm using WebLogic server. Are you suggesting that SLF4J is loading and configuring Logback twice? If this were the case, wouldn't I see duplicates of all of Logback's status messages? Do you know how I can fix this problem? Derek

Ah - I see you did a better job of me on searching. ----- Original Message ----- From: "Robert Elliot" <rob@lidalia.org.uk> To: "logback users list" <logback-user@qos.ch> Sent: Wednesday, 4 August, 2010 5:53:50 PM Subject: Re: [logback-user] Suppress or redirect Logback's internal status messages? You could raise a bug here: http://jira.qos.ch/secure/BrowseProject.jspa - I can't find one already. However, the corresponding bug in SLF4J (http://bugzilla.slf4j.org/show_bug.cgi?id=138) isn't getting a lot of love.

Yes, I reported my issue in a comment on a similar existing issue http://jira.qos.ch/browse/LBCLASSIC-159. For what it's worth, I also voted-up this issue Thank you, Derek On Wed, Aug 4, 2010 at 12:55 PM, Robert Elliot <rob@lidalia.org.uk> wrote:
Ah - I see you did a better job of me on searching.
----- Original Message ----- From: "Robert Elliot" <rob@lidalia.org.uk> To: "logback users list" <logback-user@qos.ch> Sent: Wednesday, 4 August, 2010 5:53:50 PM Subject: Re: [logback-user] Suppress or redirect Logback's internal status messages?
You could raise a bug here: http://jira.qos.ch/secure/BrowseProject.jspa - I can't find one already. However, the corresponding bug in SLF4J (http://bugzilla.slf4j.org/show_bug.cgi?id=138) isn't getting a lot of love.

Robert: I implemented a fix for LBCLASSIC-159 at http://github.com/derekmahar/logback/commit/1990e7c9c0e35ba408f73a2c654e8d29.... Derek On Wed, Aug 4, 2010 at 1:05 PM, Derek Mahar <derek.mahar@gmail.com> wrote:
Yes, I reported my issue in a comment on a similar existing issue http://jira.qos.ch/browse/LBCLASSIC-159. For what it's worth, I also voted-up this issue.
participants (2)
-
Derek Mahar
-
Robert Elliot