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 "Frank W. Zammetti" <fz...@omnytex.com> on 2005/07/07 21:44:30 UTC
XML config questino
Hi all... I have what I thought would be a simple question, but it's
completely beating me...
I am using the XML config file seen below, Log4J 1.2.8. The problem I
have is that anything that calls log.error() in my code goes to
appError.log as I want, but it *ALSO* goes to appInfo.log. I need it to
*ONLY* go to appError.log.
Problem is, I haven't been able to figure out how to configure that. I
thought I could just add another category, but because I have classes all
throughout the app in various packages, this doesn't seem to be the right
answer.
Can anyone point me in the right direction? Thanks!
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<param name="Threshold" value="DEBUG"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p %l %x- %m\n" />
</layout>
</appender>
<appender name="APPINFOFILE" class="org.apache.log4j.FileAppender">
<param name="Threshold" value="DEBUG"/>
<param name="File" value="appInfo.log"/>
<param name="Append" value="false"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p %l %x- %m\n" />
</layout>
</appender>
<appender name="APPERRORFILE" class="org.apache.log4j.FileAppender">
<param name="Threshold" value="ERROR"/>
<param name="File" value="appError.log"/>
<param name="Append" value="false"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p %l %x- %m\n" />
</layout>
</appender>
<appender name="APPAGINGFILE" class="org.apache.log4j.FileAppender">
<param name="Threshold" value="DEBUG"/>
<param name="File" value="appAging.log"/>
<param name="Append" value="false"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p %l %x- %m\n" />
</layout>
</appender>
<category name="com.company" additivity="true">
<appender-ref ref="CONSOLE" />
<appender-ref ref="APPINFOFILE" />
<appender-ref ref="APPERRORFILE" />
</category>
<category name="com.company.app.daemonthreads.AgingProcessDaemonThread"
additivity="true">
<appender-ref ref="APPAGINGFILE" />
</category>
</log4j:configuration>
--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: XML config questino
Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
Ha, just noticed the typo in my subject... questino... did I just discover
a new subatomic particle?!?
--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
On Thu, July 7, 2005 3:44 pm, Frank W. Zammetti said:
> Hi all... I have what I thought would be a simple question, but it's
> completely beating me...
>
> I am using the XML config file seen below, Log4J 1.2.8. The problem I
> have is that anything that calls log.error() in my code goes to
> appError.log as I want, but it *ALSO* goes to appInfo.log. I need it to
> *ONLY* go to appError.log.
>
> Problem is, I haven't been able to figure out how to configure that. I
> thought I could just add another category, but because I have classes all
> throughout the app in various packages, this doesn't seem to be the right
> answer.
>
> Can anyone point me in the right direction? Thanks!
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
> <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
> <param name="Threshold" value="DEBUG"/>
> <layout class="org.apache.log4j.PatternLayout">
> <param name="ConversionPattern" value="%d %-5p %l %x- %m\n" />
> </layout>
> </appender>
> <appender name="APPINFOFILE" class="org.apache.log4j.FileAppender">
> <param name="Threshold" value="DEBUG"/>
> <param name="File" value="appInfo.log"/>
> <param name="Append" value="false"/>
> <layout class="org.apache.log4j.PatternLayout">
> <param name="ConversionPattern" value="%d %-5p %l %x- %m\n" />
> </layout>
> </appender>
> <appender name="APPERRORFILE" class="org.apache.log4j.FileAppender">
> <param name="Threshold" value="ERROR"/>
> <param name="File" value="appError.log"/>
> <param name="Append" value="false"/>
> <layout class="org.apache.log4j.PatternLayout">
> <param name="ConversionPattern" value="%d %-5p %l %x- %m\n" />
> </layout>
> </appender>
> <appender name="APPAGINGFILE" class="org.apache.log4j.FileAppender">
> <param name="Threshold" value="DEBUG"/>
> <param name="File" value="appAging.log"/>
> <param name="Append" value="false"/>
> <layout class="org.apache.log4j.PatternLayout">
> <param name="ConversionPattern" value="%d %-5p %l %x- %m\n" />
> </layout>
> </appender>
> <category name="com.company" additivity="true">
> <appender-ref ref="CONSOLE" />
> <appender-ref ref="APPINFOFILE" />
> <appender-ref ref="APPERRORFILE" />
> </category>
> <category name="com.company.app.daemonthreads.AgingProcessDaemonThread"
> additivity="true">
> <appender-ref ref="APPAGINGFILE" />
> </category>
> </log4j:configuration>
>
> --
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: XML config questino
Posted by James Stauffer <st...@gmail.com>.
You would probably have to write a custom filter. Normally appenders
get everything from the specified level _and above_.
On 7/7/05, Frank W. Zammetti <fz...@omnytex.com> wrote:
> Hi all... I have what I thought would be a simple question, but it's
> completely beating me...
>
> I am using the XML config file seen below, Log4J 1.2.8. The problem I
> have is that anything that calls log.error() in my code goes to
> appError.log as I want, but it *ALSO* goes to appInfo.log. I need it to
> *ONLY* go to appError.log.
>
> Problem is, I haven't been able to figure out how to configure that. I
> thought I could just add another category, but because I have classes all
> throughout the app in various packages, this doesn't seem to be the right
> answer.
>
> Can anyone point me in the right direction? Thanks!
--
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: XML config questino
Posted by Jubin Thomas Kuriakose <ju...@integerblr.com>.
I too am looking for the answer to that one...
Frank W. Zammetti wrote:
>Is there any way to EXCLUDE something, an individual class or classes
>specifically, that would normally be included in a category? That would
>do the trick I think.
>
>If not, I suppose I could set up multiple categories, but because I'd have
>to exclude individual classes from multiple packages, it essentially means
>poerhaps hundreds of categories for the classes that SHOULD be included.
>Clearly not the right answer :)
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
RE: XML config questino
Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
Is there any way to EXCLUDE something, an individual class or classes
specifically, that would normally be included in a category? That would
do the trick I think.
If not, I suppose I could set up multiple categories, but because I'd have
to exclude individual classes from multiple packages, it essentially means
poerhaps hundreds of categories for the classes that SHOULD be included.
Clearly not the right answer :)
--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
On Thu, July 7, 2005 3:51 pm, Balaji Saranathan said:
>
>>>From your code
>
> <category name="com.company" additivity="true">
> <appender-ref ref="CONSOLE" />
> <appender-ref ref="APPINFOFILE" />
> <appender-ref ref="APPERRORFILE" />
> </category>
>
> Any loggers that are created with the classnames following this packages
> structure will have three appenders attached to it and hence will
> forward to all the three....
>
>
>
> -----Original Message-----
> From: Frank W. Zammetti [mailto:fzlists@omnytex.com]
> Sent: Thursday, July 07, 2005 3:45 PM
> To: log4j-user@logging.apache.org
> Subject: XML config questino
>
>
> Hi all... I have what I thought would be a simple question, but it's
> completely beating me...
>
> I am using the XML config file seen below, Log4J 1.2.8. The problem I
> have is that anything that calls log.error() in my code goes to
> appError.log as I want, but it *ALSO* goes to appInfo.log. I need it to
> *ONLY* go to appError.log.
>
> Problem is, I haven't been able to figure out how to configure that. I
> thought I could just add another category, but because I have classes
> all throughout the app in various packages, this doesn't seem to be the
> right answer.
>
> Can anyone point me in the right direction? Thanks!
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> <log4j:configuration
> xmlns:log4j="http://jakarta.apache.org/log4j/">
> <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
> <param name="Threshold" value="DEBUG"/>
> <layout class="org.apache.log4j.PatternLayout">
> <param name="ConversionPattern" value="%d %-5p %l %x- %m\n" />
> </layout>
> </appender>
> <appender name="APPINFOFILE" class="org.apache.log4j.FileAppender">
> <param name="Threshold" value="DEBUG"/>
> <param name="File" value="appInfo.log"/>
> <param name="Append" value="false"/>
> <layout class="org.apache.log4j.PatternLayout">
> <param name="ConversionPattern" value="%d %-5p %l %x- %m\n" />
> </layout>
> </appender>
> <appender name="APPERRORFILE" class="org.apache.log4j.FileAppender">
> <param name="Threshold" value="ERROR"/>
> <param name="File" value="appError.log"/>
> <param name="Append" value="false"/>
> <layout class="org.apache.log4j.PatternLayout">
> <param name="ConversionPattern" value="%d %-5p %l %x- %m\n" />
> </layout>
> </appender>
> <appender name="APPAGINGFILE" class="org.apache.log4j.FileAppender">
> <param name="Threshold" value="DEBUG"/>
> <param name="File" value="appAging.log"/>
> <param name="Append" value="false"/>
> <layout class="org.apache.log4j.PatternLayout">
> <param name="ConversionPattern" value="%d %-5p %l %x- %m\n" />
> </layout>
> </appender>
> <category name="com.company" additivity="true">
> <appender-ref ref="CONSOLE" />
> <appender-ref ref="APPINFOFILE" />
> <appender-ref ref="APPERRORFILE" />
> </category>
> <category
> name="com.company.app.daemonthreads.AgingProcessDaemonThread"
> additivity="true">
> <appender-ref ref="APPAGINGFILE" />
> </category>
> </log4j:configuration>
>
> --
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
>
>
> Confidentiality Notice
>
> The information contained in this electronic message and any attachments
> to this message are intended
> for the exclusive use of the addressee(s) and may contain confidential or
> privileged information. If
> you are not the intended recipient, please notify the sender at Wipro or
> Mailadmin@wipro.com immediately
> and destroy all copies of this message and any attachments.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
RE: XML config questino
Posted by Balaji Saranathan <ba...@wipro.com>.
>From your code
<category name="com.company" additivity="true">
<appender-ref ref="CONSOLE" />
<appender-ref ref="APPINFOFILE" />
<appender-ref ref="APPERRORFILE" />
</category>
Any loggers that are created with the classnames following this packages
structure will have three appenders attached to it and hence will
forward to all the three....
-----Original Message-----
From: Frank W. Zammetti [mailto:fzlists@omnytex.com]
Sent: Thursday, July 07, 2005 3:45 PM
To: log4j-user@logging.apache.org
Subject: XML config questino
Hi all... I have what I thought would be a simple question, but it's
completely beating me...
I am using the XML config file seen below, Log4J 1.2.8. The problem I
have is that anything that calls log.error() in my code goes to
appError.log as I want, but it *ALSO* goes to appInfo.log. I need it to
*ONLY* go to appError.log.
Problem is, I haven't been able to figure out how to configure that. I
thought I could just add another category, but because I have classes
all throughout the app in various packages, this doesn't seem to be the
right answer.
Can anyone point me in the right direction? Thanks!
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> <log4j:configuration
xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<param name="Threshold" value="DEBUG"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p %l %x- %m\n" />
</layout>
</appender>
<appender name="APPINFOFILE" class="org.apache.log4j.FileAppender">
<param name="Threshold" value="DEBUG"/>
<param name="File" value="appInfo.log"/>
<param name="Append" value="false"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p %l %x- %m\n" />
</layout>
</appender>
<appender name="APPERRORFILE" class="org.apache.log4j.FileAppender">
<param name="Threshold" value="ERROR"/>
<param name="File" value="appError.log"/>
<param name="Append" value="false"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p %l %x- %m\n" />
</layout>
</appender>
<appender name="APPAGINGFILE" class="org.apache.log4j.FileAppender">
<param name="Threshold" value="DEBUG"/>
<param name="File" value="appAging.log"/>
<param name="Append" value="false"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p %l %x- %m\n" />
</layout>
</appender>
<category name="com.company" additivity="true">
<appender-ref ref="CONSOLE" />
<appender-ref ref="APPINFOFILE" />
<appender-ref ref="APPERRORFILE" />
</category>
<category
name="com.company.app.daemonthreads.AgingProcessDaemonThread"
additivity="true">
<appender-ref ref="APPAGINGFILE" />
</category>
</log4j:configuration>
--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Confidentiality Notice
The information contained in this electronic message and any attachments to this message are intended
for the exclusive use of the addressee(s) and may contain confidential or privileged information. If
you are not the intended recipient, please notify the sender at Wipro or Mailadmin@wipro.com immediately
and destroy all copies of this message and any attachments.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org