You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Tim Fox <ti...@blueheath.com> on 2001/07/26 19:22:53 UTC
Stopping root category from logging child categories
I'm using log4j with jboss.
The components in Jboss uses log4j for their logging.
The log4j.properties is set up with with a root category - so all the
messages from all the components get logged to that category.
I have an application running in jboss, and I want to use my own log file -
moreover I do not want my messages ending up in the jboss log too.
I have set up my own category and my messages get logged to the fine.
The pain in arse is that they all go the root category log too!!
I can't just set the priority of that category to FATAL since then I lose
all the messages from all the other components.
Is there any way to tell a category (the root category) to ignore messages
from specific child categories??
Please help, this is doing my head in!
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org
RE: Stopping root category from logging child categories
Posted by Tim Fox <ti...@blueheath.com>.
The problem I had was in the syntax I was using, the offending line should
have read:
log4j.additivity.mercuryerror=FALSE, rather than
log4j.additivity.category.mercuryerror=FALSE
I can now report it all works fine :)
-----Original Message-----
From: Tim Fox [mailto:tim@blueheath.com]
Sent: 27 July 2001 12:23
To: LOG4J Users Mailing List
Subject: RE: Stopping root category from logging child categories
Hi Ceki-
I've done what you said, but the problem still remains - the root category
is still logging messages from the child categories.
I've got a nasty feeling that I have to set additivity to false in the *root
category* rather than in my child categories - but then the root category
won't log messages from other child categories that aren't my own. AAaaargh!
It seems to me that the additivity flag prevents a parent category
*receiving* messages from its children - what I need to do is to prevent my
child categories *sending* messages to their parents, or put another way I
need to selectively prevent Category A logging messages from any set of
Child categories that may exist.
Anyway, thanks for your help, but I'm getting worried that this isn't
possible, even though it seems a very common situation.
Here's my config file again:
# A log4j properties file suitable for replacing the
# default JBoss ConsoleLogging & FileLogging mbeans.
log4j.rootCategory=DEBUG, Default, Console
### The server.log file appender
log4j.appender.Default=org.apache.log4j.FileAppender
log4j.appender.Default.File=../log/server.log
log4j.appender.Default.layout=org.apache.log4j.PatternLayout
# Use the default JBoss format
log4j.appender.Default.layout.ConversionPattern=[%c{1}] %m%n
# Truncate if it aleady exists.
log4j.appender.Default.Append=false
#Example of turning off logging for a category. Uncomment to turn off.
log4j.category.DefaultDS=FATAL
### The console appender
log4j.appender.Console=org.jboss.logging.log4j.ConsoleAppender
log4j.appender.Console.Threshold=INFO
log4j.appender.Console.layout=org.apache.log4j.PatternLayout
log4j.appender.Console.layout.ConversionPattern=[%c{1}] %m%n
#The mercury logging configuration
#=================================
log4j.category.mercurylog=DEBUG, MercuryLog
#Stop the output of our logging ending up in any ancestor logs
log4j.additivity.category.mercurylog=FALSE
log4j.appender.MercuryLog=org.apache.log4j.RollingFileAppender
log4j.appender.MercuryLog.File=../log/mercury.log
log4j.appender.MercuryLog.layout=org.apache.log4j.PatternLayout
log4j.appender.MercuryLog.layout.ConversionPattern=%d [%t] - %m%n
log4j.appender.MercuryLog.Append=true
log4j.appender.MercuryLog.MaximumFileSize=10000000
-----Original Message-----
From: Ceki Gülcü [mailto:cgu@qos.ch]
Sent: 27 July 2001 11:22
To: LOG4J Users Mailing List
Subject: RE: Stopping root category from logging child categories
At 09:26 27.07.2001 +0100, Tim Fox wrote:
>I've had a look but can't get it to work - this doesn't seem to be anywhere
>in the docs that describe the legal values in the configuration file -
See
http://jakarta.apache.org/log4j/docs/api/org/apache/log4j/PropertyConfigurat
or.html
>therefore I've just assumed that they map to the bean properties of the
>various classes involved (is this right?).
This is true for appenders and layouts. See below.
>Based on that I've added the line
>log4j.category.mercurylog.additivity=false
The syntax is
log4j.additivity.category.name=TRUE|FALSE
>Anyway, it still doesn't work (ie the damn output still ends up in all the
>appenders)- can anyone spot the mistake????
>Here's my config file
[removed stuff]
>#The mercury logging configuration
>log4j.category.mercurylog=DEBUG, MercuryLog
>log4j.category.mercurylog.additivity=false
Try:
log4j.additivity.mercurylog=false
HTH, Ceki
>-----Original Message-----
>From: Ceki Gülcü [mailto:cgu@qos.ch]
>Sent: 26 July 2001 21:21
>To: LOG4J Users Mailing List
>Subject: Re: Stopping root category from logging child categories
>
>
>
>Tim,
>
>See appender additivity. It's probably what you want.
>
>At 18:22 26.07.2001 +0100, Tim Fox wrote:
>>I'm using log4j with jboss.
>>The components in Jboss uses log4j for their logging.
>>The log4j.properties is set up with with a root category - so all the
>>messages from all the components get logged to that category.
>>I have an application running in jboss, and I want to use my own log
file -
>>moreover I do not want my messages ending up in the jboss log too.
>>I have set up my own category and my messages get logged to the fine.
>>The pain in arse is that they all go the root category log too!!
>>I can't just set the priority of that category to FATAL since then I lose
>>all the messages from all the other components.
>>Is there any way to tell a category (the root category) to ignore messages
>>from specific child categories??
>>Please help, this is doing my head in!
--
Ceki Gülcü - http://qos.ch
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org
RE: Stopping root category from logging child categories
Posted by Tim Fox <ti...@blueheath.com>.
Hi Ceki-
I've done what you said, but the problem still remains - the root category
is still logging messages from the child categories.
I've got a nasty feeling that I have to set additivity to false in the *root
category* rather than in my child categories - but then the root category
won't log messages from other child categories that aren't my own. AAaaargh!
It seems to me that the additivity flag prevents a parent category
*receiving* messages from its children - what I need to do is to prevent my
child categories *sending* messages to their parents, or put another way I
need to selectively prevent Category A logging messages from any set of
Child categories that may exist.
Anyway, thanks for your help, but I'm getting worried that this isn't
possible, even though it seems a very common situation.
Here's my config file again:
# A log4j properties file suitable for replacing the
# default JBoss ConsoleLogging & FileLogging mbeans.
log4j.rootCategory=DEBUG, Default, Console
### The server.log file appender
log4j.appender.Default=org.apache.log4j.FileAppender
log4j.appender.Default.File=../log/server.log
log4j.appender.Default.layout=org.apache.log4j.PatternLayout
# Use the default JBoss format
log4j.appender.Default.layout.ConversionPattern=[%c{1}] %m%n
# Truncate if it aleady exists.
log4j.appender.Default.Append=false
#Example of turning off logging for a category. Uncomment to turn off.
log4j.category.DefaultDS=FATAL
### The console appender
log4j.appender.Console=org.jboss.logging.log4j.ConsoleAppender
log4j.appender.Console.Threshold=INFO
log4j.appender.Console.layout=org.apache.log4j.PatternLayout
log4j.appender.Console.layout.ConversionPattern=[%c{1}] %m%n
#The mercury logging configuration
#=================================
log4j.category.mercurylog=DEBUG, MercuryLog
#Stop the output of our logging ending up in any ancestor logs
log4j.additivity.category.mercurylog=FALSE
log4j.appender.MercuryLog=org.apache.log4j.RollingFileAppender
log4j.appender.MercuryLog.File=../log/mercury.log
log4j.appender.MercuryLog.layout=org.apache.log4j.PatternLayout
log4j.appender.MercuryLog.layout.ConversionPattern=%d [%t] - %m%n
log4j.appender.MercuryLog.Append=true
log4j.appender.MercuryLog.MaximumFileSize=10000000
-----Original Message-----
From: Ceki Gülcü [mailto:cgu@qos.ch]
Sent: 27 July 2001 11:22
To: LOG4J Users Mailing List
Subject: RE: Stopping root category from logging child categories
At 09:26 27.07.2001 +0100, Tim Fox wrote:
>I've had a look but can't get it to work - this doesn't seem to be anywhere
>in the docs that describe the legal values in the configuration file -
See
http://jakarta.apache.org/log4j/docs/api/org/apache/log4j/PropertyConfigurat
or.html
>therefore I've just assumed that they map to the bean properties of the
>various classes involved (is this right?).
This is true for appenders and layouts. See below.
>Based on that I've added the line
>log4j.category.mercurylog.additivity=false
The syntax is
log4j.additivity.category.name=TRUE|FALSE
>Anyway, it still doesn't work (ie the damn output still ends up in all the
>appenders)- can anyone spot the mistake????
>Here's my config file
[removed stuff]
>#The mercury logging configuration
>log4j.category.mercurylog=DEBUG, MercuryLog
>log4j.category.mercurylog.additivity=false
Try:
log4j.additivity.mercurylog=false
HTH, Ceki
>-----Original Message-----
>From: Ceki Gülcü [mailto:cgu@qos.ch]
>Sent: 26 July 2001 21:21
>To: LOG4J Users Mailing List
>Subject: Re: Stopping root category from logging child categories
>
>
>
>Tim,
>
>See appender additivity. It's probably what you want.
>
>At 18:22 26.07.2001 +0100, Tim Fox wrote:
>>I'm using log4j with jboss.
>>The components in Jboss uses log4j for their logging.
>>The log4j.properties is set up with with a root category - so all the
>>messages from all the components get logged to that category.
>>I have an application running in jboss, and I want to use my own log
file -
>>moreover I do not want my messages ending up in the jboss log too.
>>I have set up my own category and my messages get logged to the fine.
>>The pain in arse is that they all go the root category log too!!
>>I can't just set the priority of that category to FATAL since then I lose
>>all the messages from all the other components.
>>Is there any way to tell a category (the root category) to ignore messages
>>from specific child categories??
>>Please help, this is doing my head in!
--
Ceki Gülcü - http://qos.ch
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org
RE: Stopping root category from logging child categories
Posted by Ceki Gülcü <cg...@qos.ch>.
At 09:26 27.07.2001 +0100, Tim Fox wrote:
>I've had a look but can't get it to work - this doesn't seem to be anywhere
>in the docs that describe the legal values in the configuration file -
See http://jakarta.apache.org/log4j/docs/api/org/apache/log4j/PropertyConfigurator.html
>therefore I've just assumed that they map to the bean properties of the
>various classes involved (is this right?).
This is true for appenders and layouts. See below.
>Based on that I've added the line
>log4j.category.mercurylog.additivity=false
The syntax is
log4j.additivity.category.name=TRUE|FALSE
>Anyway, it still doesn't work (ie the damn output still ends up in all the
>appenders)- can anyone spot the mistake????
>Here's my config file
[removed stuff]
>#The mercury logging configuration
>log4j.category.mercurylog=DEBUG, MercuryLog
>log4j.category.mercurylog.additivity=false
Try:
log4j.additivity.mercurylog=false
HTH, Ceki
>-----Original Message-----
>From: Ceki Gülcü [mailto:cgu@qos.ch]
>Sent: 26 July 2001 21:21
>To: LOG4J Users Mailing List
>Subject: Re: Stopping root category from logging child categories
>
>
>
>Tim,
>
>See appender additivity. It's probably what you want.
>
>At 18:22 26.07.2001 +0100, Tim Fox wrote:
>>I'm using log4j with jboss.
>>The components in Jboss uses log4j for their logging.
>>The log4j.properties is set up with with a root category - so all the
>>messages from all the components get logged to that category.
>>I have an application running in jboss, and I want to use my own log file -
>>moreover I do not want my messages ending up in the jboss log too.
>>I have set up my own category and my messages get logged to the fine.
>>The pain in arse is that they all go the root category log too!!
>>I can't just set the priority of that category to FATAL since then I lose
>>all the messages from all the other components.
>>Is there any way to tell a category (the root category) to ignore messages
>>from specific child categories??
>>Please help, this is doing my head in!
--
Ceki Gülcü - http://qos.ch
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org
RE: Stopping root category from logging child categories
Posted by Tim Fox <ti...@blueheath.com>.
I've had a look but can't get it to work - this doesn't seem to be anywhere
in the docs that describe the legal values in the configuration file -
therefore I've just assumed that they map to the bean properties of the
various classes involved (is this right?).
Based on that I've added the line
log4j.category.mercurylog.additivity=false
Anyway, it still doesn't work (ie the damn output still ends up in all the
appenders)- can anyone spot the mistake????
Here's my config file
A log4j properties file suitable for replacing the
# default JBoss ConsoleLogging & FileLogging mbeans.
log4j.rootCategory=DEBUG, Default, Console
##JBoss stuff
### The server.log file appender
log4j.appender.Default=org.apache.log4j.FileAppender
log4j.appender.Default.File=../log/server.log
log4j.appender.Default.layout=org.apache.log4j.PatternLayout
# Use the default JBoss format
log4j.appender.Default.layout.ConversionPattern=[%c{1}] %m%n
# Truncate if it aleady exists.
log4j.appender.Default.Append=false
#Example of turning off logging for a category. Uncomment to turn off.
#log4j.category.DefaultDS=FATAL
### The console appender
log4j.appender.Console=org.jboss.logging.log4j.ConsoleAppender
log4j.appender.Console.Threshold=INFO
log4j.appender.Console.layout=org.apache.log4j.PatternLayout
log4j.appender.Console.layout.ConversionPattern=[%c{1}] %m%n
##End of JBoss stuff
#The mercury logging configuration
log4j.category.mercurylog=DEBUG, MercuryLog
log4j.category.mercurylog.additivity=false
log4j.appender.MercuryLog=org.apache.log4j.RollingFileAppender
log4j.appender.MercuryLog.File=../log/mercury.log
log4j.appender.MercuryLog.layout=org.apache.log4j.PatternLayout
log4j.appender.MercuryLog.layout.ConversionPattern=%d [%t] - %m%n
log4j.appender.MercuryLog.Append=true
log4j.appender.MercuryLog.MaximumFileSize=10000000
-----Original Message-----
From: Ceki Gülcü [mailto:cgu@qos.ch]
Sent: 26 July 2001 21:21
To: LOG4J Users Mailing List
Subject: Re: Stopping root category from logging child categories
Tim,
See appender additivity. It's probably what you want.
At 18:22 26.07.2001 +0100, Tim Fox wrote:
>I'm using log4j with jboss.
>The components in Jboss uses log4j for their logging.
>The log4j.properties is set up with with a root category - so all the
>messages from all the components get logged to that category.
>I have an application running in jboss, and I want to use my own log file -
>moreover I do not want my messages ending up in the jboss log too.
>I have set up my own category and my messages get logged to the fine.
>The pain in arse is that they all go the root category log too!!
>I can't just set the priority of that category to FATAL since then I lose
>all the messages from all the other components.
>Is there any way to tell a category (the root category) to ignore messages
>from specific child categories??
>Please help, this is doing my head in!
--
Ceki Gülcü - http://qos.ch
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org
Re: Stopping root category from logging child categories
Posted by Ceki Gülcü <cg...@qos.ch>.
Tim,
See appender additivity. It's probably what you want.
At 18:22 26.07.2001 +0100, Tim Fox wrote:
>I'm using log4j with jboss.
>The components in Jboss uses log4j for their logging.
>The log4j.properties is set up with with a root category - so all the
>messages from all the components get logged to that category.
>I have an application running in jboss, and I want to use my own log file -
>moreover I do not want my messages ending up in the jboss log too.
>I have set up my own category and my messages get logged to the fine.
>The pain in arse is that they all go the root category log too!!
>I can't just set the priority of that category to FATAL since then I lose
>all the messages from all the other components.
>Is there any way to tell a category (the root category) to ignore messages
>from specific child categories??
>Please help, this is doing my head in!
--
Ceki Gülcü - http://qos.ch
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org