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 Joseph Sartre <jo...@msn.com> on 2005/06/20 17:03:26 UTC

mutiple logs & levels

Is it possible that the logging is in 2 different logs:

I am trying to log in 2 ways:
- The Info level and only the info level (not warn, error or fatal) will log 
in a document called logInformation.log
- the other levels (warn, error, fatal etc) will log in a ocument called 
logSystem.log

I have tried to create the config file but i always get all the entries in 
both the logs.

Thanks for your help

Here is my config file:

log4j.rootLogger=info, appenderSys, appenderInfo

log4j.category.info=info, appenderInfo
log4j.additivity.info=false
log4j.category.sys=warn, appenderSys
log4j.additivity.sys=false
log4j.category.error=error, appenderSys
log4j.additivity.error=false
log4j.category.fatal=fatal, appenderSys
log4j.additivity.fatal=false

#AppenderSys
log4j.appender.appenderSys=org.apache.log4j.RollingFileAppender
log4j.appender.appenderSys.File=logSystem.log
log4j.appender.appenderSys.layout=org.apache.log4j.PatternLayout
log4j.appender.appenderSys.MaxFileSize=100000KB
log4j.appender.appenderSys.MaxBackupIndex=1
log4j.appender.appenderSys.layout.ConversionPattern=%d{dd MM yyyy HH:mm:ss} 
[%t] %p - %m%n

#AppenderInfo
log4j.appender.appenderInfo=org.apache.log4j.RollingFileAppender
log4j.appender.appenderInfo.File=logInformation.log
log4j.appender.appenderInfo.MaxFileSize=100000KB
log4j.appender.appenderInfo.MaxBackupIndex=1
log4j.appender.appenderInfo.layout=org.apache.log4j.PatternLayout
log4j.appender.appenderInfo.layout.ConversionPattern=%d{dd MM yyyy HH:mm:ss} 
[%t] %p - %m%n



-----------
Alternative email: js397@st-andrews.ac.uk
Personal Website: http://www.yussef.no-ip.com
Mobile UK: +447704456081
Mobile FR: +33665668941



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: mutiple logs & levels

Posted by Joseph Sartre <jo...@msn.com>.
Thanks a lot this is exactly what i needed.
Thanks to you

Hasta luego

Joseph

-----------
Alternative email: js397@st-andrews.ac.uk
Personal Website: http://www.yussef.no-ip.com
Mobile UK: +447704456081
Mobile FR: +33665668941



>From: Jacob Kjome <ho...@visi.com>
>Reply-To: "Log4J Users List" <lo...@logging.apache.org>
>To: Log4J Users List <lo...@logging.apache.org>
>Subject: Re: mutiple logs & levels
>Date: Mon, 20 Jun 2005 16:19:55 -0500
>
>
>Ok, forget what I said earlier.  I'm not sure what I was reading?  Must be 
>tired
>today.  Anyway, your XML config below should work.  I expect that the 
>logger
>"com.mee.topup.util" and its children would log at the info level (and 
>above)
>to the appenderInfo appender.  All other loggers outside of this naming
>hierarchy would log to the appenderSystem appender at the debug level (and
>above).
>
>Is this not what you are seeing?
>
>Are you saying that when the log level for "com.mee.topup.util" and its 
>children
>is something other than "info", you would like it not to be logged to the
>appederInfo appender, but to the appenderSystem appender?  Then you don't 
>want
>to use turn off additivity at all.  Set up the appenderInfo appender to 
>have
>both the MIN and MAX levels set to "info".  You don't need to specify the 
>level
>value for the "com.mee.topup.util" logger, just the appenderInfo appender.  
>So
>leave your root logger config alone and do....
>
>   <appender name="appenderInfo" 
>class="org.apache.log4j.RollingFileAppender">
>     <param name="MinLevel" value="INFO"/>
>     <param name="MaxLevel" value="INFO"/>
>     ....
>     ....
>     ....
>   </appender>
>
>   <logger name="com.mee.topup.util">
>         <appender-ref ref="appenderInfo"/>
>   </logger>
>
>
>I think "MinLevel" and "MaxLevel" are the correct values, but that's just 
>from
>memory, so if it doesn't work, double check the docs.
>
>
>BTW, you should use <logger> instead of <category> and <level> instead of
><priority>.
>
>
>Jake
>
>Quoting Joseph Sartre <jo...@msn.com>:
>
> > Maybe I did not express my self clearly enough:
> > What I would like is to log only the info level in a seperate log.
> > this is why I have appenderInfo pointing to logInformation.log.
> > The rest of the logs (warn, error, fatal) would be logged in another
> > file called logSystem.log.
> > Basically I have program which makes transactions... when it does I 
>would
> > call the info method to log the transactions and when something goes 
>wrong,
> > it will be logged into the logSystem.log (describing the system's 
>problems).
> >
> > Thanks for your answer though,
> > Here is a modified config file this time in xml:
> >
> > <?xml version="1.0" encoding="UTF-8" ?>
> > <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
> > <!-- 
>=====================================================================
> > -->
> > <!-- |                 Log4j ^_^ Logs de la aplicacion.                  
>|
> > -->
> > <!-- 
>=====================================================================
> > -->
> >
> > <!-- Principio de la Configuration -->
> > <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
> >   <!-- Creacion del appender appenderSystem por los mensajes warn, 
>fatal,
> > error -->
> >   <appender name="appenderSystem"
> > class="org.apache.log4j.RollingFileAppender">
> >     <param name="Threshold" value="WARN"/>
> > 	<!-- Nombre del Documento -->
> >     <param name="File" value="logSystem.log"/>
> >     <param name="Append" value="true"/>
> > 	<!-- Peso maxima del log -->
> >     <param name="MaxFileSize" value="100000KB"/>
> > 	<!-- Número de reservas -->
> >     <param name="MaxBackupIndex" value="1"/>
> > 	<!-- Layout pattern -->
> >     <layout class="org.apache.log4j.PatternLayout">
> >       <param name="ConversionPattern" value="%d{dd MM yyyy HH:mm:ss} 
>[%t] %p
> > - %m%n"/>
> >     </layout>
> >   </appender>
> >   <!-- Creacion del appender appenderSystem por los mensajes warn, 
>fatal,
> > error -->
> >   <appender name="appenderInfo"
> > class="org.apache.log4j.RollingFileAppender">
> >     <param name="Threshold" value="INFO"/>
> > 	<!-- Nombre del Documento -->
> >     <param name="File" value="logInformation.log"/>
> >     <param name="Append" value="true"/>
> > 	<!-- Peso maxima del log -->
> >     <param name="MaxFileSize" value="100000KB"/>
> > 	<!-- Número de reservas -->
> >     <param name="MaxBackupIndex" value="1"/>
> > 	<!-- Layout pattern -->
> >     <layout class="org.apache.log4j.PatternLayout">
> >       <param name="ConversionPattern" value="%d{dd MM yyyy HH:mm:ss} 
>[%t] %p
> > - %m%n"/>
> >     </layout>
> >   </appender>
> >   <!-- Declaracion de la categoria -->
> >   <category name="com.mee.topup.util" additivity="false">
> > 	<priority value="info"/>
> > 	<appender-ref ref="appenderInfo"/>
> >   </category>
> >   <!-- Definicoin del RootLogger -->
> >   <root>
> >     <priority value ="debug"/>
> >     <appender-ref ref="appenderSystem"/>
> >   </root>
> > </log4j:configuration>
> >
> >
> > -----------
> > Alternative email: js397@st-andrews.ac.uk
> > Personal Website: http://www.yussef.no-ip.com
> > Mobile UK: +447704456081
> > Mobile FR: +33665668941
> >
> >
> >
> > >From: Jacob Kjome <ho...@visi.com>
> > >Reply-To: "Log4J Users List" <lo...@logging.apache.org>
> > >To: Log4J Users List <lo...@logging.apache.org>
> > >Subject: Re: mutiple logs & levels
> > >Date: Mon, 20 Jun 2005 14:55:09 -0500
> > >
> > >
> > >You have set up the root logger to log the info level of all loggers to
> > >appenderSys.  Therefore, the appenderSys log file will get info-level
> > >logging.
> > >You might try changing the root logger's default level to be something 
>like
> > >"warn", or don't add appenderSys to the root logger.
> > >
> > >Jake
> > >
> > >Quoting Joseph Sartre <jo...@msn.com>:
> > >
> > > > Is it possible that the logging is in 2 different logs:
> > > >
> > > > I am trying to log in 2 ways:
> > > > - The Info level and only the info level (not warn, error or fatal) 
>will
> > >log
> > > > in a document called logInformation.log
> > > > - the other levels (warn, error, fatal etc) will log in a ocument 
>called
> > > > logSystem.log
> > > >
> > > > I have tried to create the config file but i always get all the 
>entries
> > >in
> > > > both the logs.
> > > >
> > > > Thanks for your help
> > > >
> > > > Here is my config file:
> > > >
> > > > log4j.rootLogger=info, appenderSys, appenderInfo
> > > >
> > > > log4j.category.info=info, appenderInfo
> > > > log4j.additivity.info=false
> > > > log4j.category.sys=warn, appenderSys
> > > > log4j.additivity.sys=false
> > > > log4j.category.error=error, appenderSys
> > > > log4j.additivity.error=false
> > > > log4j.category.fatal=fatal, appenderSys
> > > > log4j.additivity.fatal=false
> > > >
> > > > #AppenderSys
> > > > log4j.appender.appenderSys=org.apache.log4j.RollingFileAppender
> > > > log4j.appender.appenderSys.File=logSystem.log
> > > > log4j.appender.appenderSys.layout=org.apache.log4j.PatternLayout
> > > > log4j.appender.appenderSys.MaxFileSize=100000KB
> > > > log4j.appender.appenderSys.MaxBackupIndex=1
> > > > log4j.appender.appenderSys.layout.ConversionPattern=%d{dd MM yyyy
> > >HH:mm:ss}
> > > > [%t] %p - %m%n
> > > >
> > > > #AppenderInfo
> > > > log4j.appender.appenderInfo=org.apache.log4j.RollingFileAppender
> > > > log4j.appender.appenderInfo.File=logInformation.log
> > > > log4j.appender.appenderInfo.MaxFileSize=100000KB
> > > > log4j.appender.appenderInfo.MaxBackupIndex=1
> > > > log4j.appender.appenderInfo.layout=org.apache.log4j.PatternLayout
> > > > log4j.appender.appenderInfo.layout.ConversionPattern=%d{dd MM yyyy
> > >HH:mm:ss}
> > > > [%t] %p - %m%n
> > > >
> > > >
> > > >
> > > > -----------
> > > > Alternative email: js397@st-andrews.ac.uk
> > > > Personal Website: http://www.yussef.no-ip.com
> > > > Mobile UK: +447704456081
> > > > Mobile FR: +33665668941
> > > >
> > > >
> > > >
> > > > 
>---------------------------------------------------------------------
> > > > 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
> > >
> >
> >
> >
> > ---------------------------------------------------------------------
> > 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
>



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: mutiple logs & levels

Posted by Jacob Kjome <ho...@visi.com>.
Ok, forget what I said earlier.  I'm not sure what I was reading?  Must be tired
today.  Anyway, your XML config below should work.  I expect that the logger
"com.mee.topup.util" and its children would log at the info level (and above)
to the appenderInfo appender.  All other loggers outside of this naming
hierarchy would log to the appenderSystem appender at the debug level (and
above).

Is this not what you are seeing?

Are you saying that when the log level for "com.mee.topup.util" and its children
is something other than "info", you would like it not to be logged to the
appederInfo appender, but to the appenderSystem appender?  Then you don't want
to use turn off additivity at all.  Set up the appenderInfo appender to have
both the MIN and MAX levels set to "info".  You don't need to specify the level
value for the "com.mee.topup.util" logger, just the appenderInfo appender.  So
leave your root logger config alone and do....

  <appender name="appenderInfo" class="org.apache.log4j.RollingFileAppender">
    <param name="MinLevel" value="INFO"/>
    <param name="MaxLevel" value="INFO"/>
    ....
    ....
    ....
  </appender>

  <logger name="com.mee.topup.util">
        <appender-ref ref="appenderInfo"/>
  </logger>


I think "MinLevel" and "MaxLevel" are the correct values, but that's just from
memory, so if it doesn't work, double check the docs.


BTW, you should use <logger> instead of <category> and <level> instead of
<priority>.


Jake

Quoting Joseph Sartre <jo...@msn.com>:

> Maybe I did not express my self clearly enough:
> What I would like is to log only the info level in a seperate log.
> this is why I have appenderInfo pointing to logInformation.log.
> The rest of the logs (warn, error, fatal) would be logged in another
> file called logSystem.log.
> Basically I have program which makes transactions... when it does I would
> call the info method to log the transactions and when something goes wrong,
> it will be logged into the logSystem.log (describing the system's problems).
>
> Thanks for your answer though,
> Here is a modified config file this time in xml:
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
> <!-- =====================================================================
> -->
> <!-- |                 Log4j ^_^ Logs de la aplicacion.                  |
> -->
> <!-- =====================================================================
> -->
>
> <!-- Principio de la Configuration -->
> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
>   <!-- Creacion del appender appenderSystem por los mensajes warn, fatal,
> error -->
>   <appender name="appenderSystem"
> class="org.apache.log4j.RollingFileAppender">
>     <param name="Threshold" value="WARN"/>
> 	<!-- Nombre del Documento -->
>     <param name="File" value="logSystem.log"/>
>     <param name="Append" value="true"/>
> 	<!-- Peso maxima del log -->
>     <param name="MaxFileSize" value="100000KB"/>
> 	<!-- Número de reservas -->
>     <param name="MaxBackupIndex" value="1"/>
> 	<!-- Layout pattern -->
>     <layout class="org.apache.log4j.PatternLayout">
>       <param name="ConversionPattern" value="%d{dd MM yyyy HH:mm:ss} [%t] %p
> - %m%n"/>
>     </layout>
>   </appender>
>   <!-- Creacion del appender appenderSystem por los mensajes warn, fatal,
> error -->
>   <appender name="appenderInfo"
> class="org.apache.log4j.RollingFileAppender">
>     <param name="Threshold" value="INFO"/>
> 	<!-- Nombre del Documento -->
>     <param name="File" value="logInformation.log"/>
>     <param name="Append" value="true"/>
> 	<!-- Peso maxima del log -->
>     <param name="MaxFileSize" value="100000KB"/>
> 	<!-- Número de reservas -->
>     <param name="MaxBackupIndex" value="1"/>
> 	<!-- Layout pattern -->
>     <layout class="org.apache.log4j.PatternLayout">
>       <param name="ConversionPattern" value="%d{dd MM yyyy HH:mm:ss} [%t] %p
> - %m%n"/>
>     </layout>
>   </appender>
>   <!-- Declaracion de la categoria -->
>   <category name="com.mee.topup.util" additivity="false">
> 	<priority value="info"/>
> 	<appender-ref ref="appenderInfo"/>
>   </category>
>   <!-- Definicoin del RootLogger -->
>   <root>
>     <priority value ="debug"/>
>     <appender-ref ref="appenderSystem"/>
>   </root>
> </log4j:configuration>
>
>
> -----------
> Alternative email: js397@st-andrews.ac.uk
> Personal Website: http://www.yussef.no-ip.com
> Mobile UK: +447704456081
> Mobile FR: +33665668941
>
>
>
> >From: Jacob Kjome <ho...@visi.com>
> >Reply-To: "Log4J Users List" <lo...@logging.apache.org>
> >To: Log4J Users List <lo...@logging.apache.org>
> >Subject: Re: mutiple logs & levels
> >Date: Mon, 20 Jun 2005 14:55:09 -0500
> >
> >
> >You have set up the root logger to log the info level of all loggers to
> >appenderSys.  Therefore, the appenderSys log file will get info-level
> >logging.
> >You might try changing the root logger's default level to be something like
> >"warn", or don't add appenderSys to the root logger.
> >
> >Jake
> >
> >Quoting Joseph Sartre <jo...@msn.com>:
> >
> > > Is it possible that the logging is in 2 different logs:
> > >
> > > I am trying to log in 2 ways:
> > > - The Info level and only the info level (not warn, error or fatal) will
> >log
> > > in a document called logInformation.log
> > > - the other levels (warn, error, fatal etc) will log in a ocument called
> > > logSystem.log
> > >
> > > I have tried to create the config file but i always get all the entries
> >in
> > > both the logs.
> > >
> > > Thanks for your help
> > >
> > > Here is my config file:
> > >
> > > log4j.rootLogger=info, appenderSys, appenderInfo
> > >
> > > log4j.category.info=info, appenderInfo
> > > log4j.additivity.info=false
> > > log4j.category.sys=warn, appenderSys
> > > log4j.additivity.sys=false
> > > log4j.category.error=error, appenderSys
> > > log4j.additivity.error=false
> > > log4j.category.fatal=fatal, appenderSys
> > > log4j.additivity.fatal=false
> > >
> > > #AppenderSys
> > > log4j.appender.appenderSys=org.apache.log4j.RollingFileAppender
> > > log4j.appender.appenderSys.File=logSystem.log
> > > log4j.appender.appenderSys.layout=org.apache.log4j.PatternLayout
> > > log4j.appender.appenderSys.MaxFileSize=100000KB
> > > log4j.appender.appenderSys.MaxBackupIndex=1
> > > log4j.appender.appenderSys.layout.ConversionPattern=%d{dd MM yyyy
> >HH:mm:ss}
> > > [%t] %p - %m%n
> > >
> > > #AppenderInfo
> > > log4j.appender.appenderInfo=org.apache.log4j.RollingFileAppender
> > > log4j.appender.appenderInfo.File=logInformation.log
> > > log4j.appender.appenderInfo.MaxFileSize=100000KB
> > > log4j.appender.appenderInfo.MaxBackupIndex=1
> > > log4j.appender.appenderInfo.layout=org.apache.log4j.PatternLayout
> > > log4j.appender.appenderInfo.layout.ConversionPattern=%d{dd MM yyyy
> >HH:mm:ss}
> > > [%t] %p - %m%n
> > >
> > >
> > >
> > > -----------
> > > Alternative email: js397@st-andrews.ac.uk
> > > Personal Website: http://www.yussef.no-ip.com
> > > Mobile UK: +447704456081
> > > Mobile FR: +33665668941
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > 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
> >
>
>
>
> ---------------------------------------------------------------------
> 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: mutiple logs & levels

Posted by Joseph Sartre <jo...@msn.com>.
Maybe I did not express my self clearly enough:
What I would like is to log only the info level in a seperate log.
this is why I have appenderInfo pointing to logInformation.log.
The rest of the logs (warn, error, fatal) would be logged in another
file called logSystem.log.
Basically I have program which makes transactions... when it does I would
call the info method to log the transactions and when something goes wrong,
it will be logged into the logSystem.log (describing the system's problems).

Thanks for your answer though,
Here is a modified config file this time in xml:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<!-- ===================================================================== 
-->
<!-- |                 Log4j ^_^ Logs de la aplicacion.                  | 
-->
<!-- ===================================================================== 
-->

<!-- Principio de la Configuration -->
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
  <!-- Creacion del appender appenderSystem por los mensajes warn, fatal, 
error -->
  <appender name="appenderSystem" 
class="org.apache.log4j.RollingFileAppender">
    <param name="Threshold" value="WARN"/>
	<!-- Nombre del Documento -->
    <param name="File" value="logSystem.log"/>
    <param name="Append" value="true"/>
	<!-- Peso maxima del log -->
    <param name="MaxFileSize" value="100000KB"/>
	<!-- Número de reservas -->
    <param name="MaxBackupIndex" value="1"/>
	<!-- Layout pattern -->
    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern" value="%d{dd MM yyyy HH:mm:ss} [%t] %p 
- %m%n"/>
    </layout>
  </appender>
  <!-- Creacion del appender appenderSystem por los mensajes warn, fatal, 
error -->
  <appender name="appenderInfo" 
class="org.apache.log4j.RollingFileAppender">
    <param name="Threshold" value="INFO"/>
	<!-- Nombre del Documento -->
    <param name="File" value="logInformation.log"/>
    <param name="Append" value="true"/>
	<!-- Peso maxima del log -->
    <param name="MaxFileSize" value="100000KB"/>
	<!-- Número de reservas -->
    <param name="MaxBackupIndex" value="1"/>
	<!-- Layout pattern -->
    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern" value="%d{dd MM yyyy HH:mm:ss} [%t] %p 
- %m%n"/>
    </layout>
  </appender>
  <!-- Declaracion de la categoria -->
  <category name="com.mee.topup.util" additivity="false">
	<priority value="info"/>
	<appender-ref ref="appenderInfo"/>
  </category>
  <!-- Definicoin del RootLogger -->
  <root>
    <priority value ="debug"/>
    <appender-ref ref="appenderSystem"/>
  </root>
</log4j:configuration>


-----------
Alternative email: js397@st-andrews.ac.uk
Personal Website: http://www.yussef.no-ip.com
Mobile UK: +447704456081
Mobile FR: +33665668941



>From: Jacob Kjome <ho...@visi.com>
>Reply-To: "Log4J Users List" <lo...@logging.apache.org>
>To: Log4J Users List <lo...@logging.apache.org>
>Subject: Re: mutiple logs & levels
>Date: Mon, 20 Jun 2005 14:55:09 -0500
>
>
>You have set up the root logger to log the info level of all loggers to
>appenderSys.  Therefore, the appenderSys log file will get info-level 
>logging.
>You might try changing the root logger's default level to be something like
>"warn", or don't add appenderSys to the root logger.
>
>Jake
>
>Quoting Joseph Sartre <jo...@msn.com>:
>
> > Is it possible that the logging is in 2 different logs:
> >
> > I am trying to log in 2 ways:
> > - The Info level and only the info level (not warn, error or fatal) will 
>log
> > in a document called logInformation.log
> > - the other levels (warn, error, fatal etc) will log in a ocument called
> > logSystem.log
> >
> > I have tried to create the config file but i always get all the entries 
>in
> > both the logs.
> >
> > Thanks for your help
> >
> > Here is my config file:
> >
> > log4j.rootLogger=info, appenderSys, appenderInfo
> >
> > log4j.category.info=info, appenderInfo
> > log4j.additivity.info=false
> > log4j.category.sys=warn, appenderSys
> > log4j.additivity.sys=false
> > log4j.category.error=error, appenderSys
> > log4j.additivity.error=false
> > log4j.category.fatal=fatal, appenderSys
> > log4j.additivity.fatal=false
> >
> > #AppenderSys
> > log4j.appender.appenderSys=org.apache.log4j.RollingFileAppender
> > log4j.appender.appenderSys.File=logSystem.log
> > log4j.appender.appenderSys.layout=org.apache.log4j.PatternLayout
> > log4j.appender.appenderSys.MaxFileSize=100000KB
> > log4j.appender.appenderSys.MaxBackupIndex=1
> > log4j.appender.appenderSys.layout.ConversionPattern=%d{dd MM yyyy 
>HH:mm:ss}
> > [%t] %p - %m%n
> >
> > #AppenderInfo
> > log4j.appender.appenderInfo=org.apache.log4j.RollingFileAppender
> > log4j.appender.appenderInfo.File=logInformation.log
> > log4j.appender.appenderInfo.MaxFileSize=100000KB
> > log4j.appender.appenderInfo.MaxBackupIndex=1
> > log4j.appender.appenderInfo.layout=org.apache.log4j.PatternLayout
> > log4j.appender.appenderInfo.layout.ConversionPattern=%d{dd MM yyyy 
>HH:mm:ss}
> > [%t] %p - %m%n
> >
> >
> >
> > -----------
> > Alternative email: js397@st-andrews.ac.uk
> > Personal Website: http://www.yussef.no-ip.com
> > Mobile UK: +447704456081
> > Mobile FR: +33665668941
> >
> >
> >
> > ---------------------------------------------------------------------
> > 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
>



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: mutiple logs & levels

Posted by Jacob Kjome <ho...@visi.com>.
You have set up the root logger to log the info level of all loggers to
appenderSys.  Therefore, the appenderSys log file will get info-level logging. 
You might try changing the root logger's default level to be something like
"warn", or don't add appenderSys to the root logger.

Jake

Quoting Joseph Sartre <jo...@msn.com>:

> Is it possible that the logging is in 2 different logs:
>
> I am trying to log in 2 ways:
> - The Info level and only the info level (not warn, error or fatal) will log
> in a document called logInformation.log
> - the other levels (warn, error, fatal etc) will log in a ocument called
> logSystem.log
>
> I have tried to create the config file but i always get all the entries in
> both the logs.
>
> Thanks for your help
>
> Here is my config file:
>
> log4j.rootLogger=info, appenderSys, appenderInfo
>
> log4j.category.info=info, appenderInfo
> log4j.additivity.info=false
> log4j.category.sys=warn, appenderSys
> log4j.additivity.sys=false
> log4j.category.error=error, appenderSys
> log4j.additivity.error=false
> log4j.category.fatal=fatal, appenderSys
> log4j.additivity.fatal=false
>
> #AppenderSys
> log4j.appender.appenderSys=org.apache.log4j.RollingFileAppender
> log4j.appender.appenderSys.File=logSystem.log
> log4j.appender.appenderSys.layout=org.apache.log4j.PatternLayout
> log4j.appender.appenderSys.MaxFileSize=100000KB
> log4j.appender.appenderSys.MaxBackupIndex=1
> log4j.appender.appenderSys.layout.ConversionPattern=%d{dd MM yyyy HH:mm:ss}
> [%t] %p - %m%n
>
> #AppenderInfo
> log4j.appender.appenderInfo=org.apache.log4j.RollingFileAppender
> log4j.appender.appenderInfo.File=logInformation.log
> log4j.appender.appenderInfo.MaxFileSize=100000KB
> log4j.appender.appenderInfo.MaxBackupIndex=1
> log4j.appender.appenderInfo.layout=org.apache.log4j.PatternLayout
> log4j.appender.appenderInfo.layout.ConversionPattern=%d{dd MM yyyy HH:mm:ss}
> [%t] %p - %m%n
>
>
>
> -----------
> Alternative email: js397@st-andrews.ac.uk
> Personal Website: http://www.yussef.no-ip.com
> Mobile UK: +447704456081
> Mobile FR: +33665668941
>
>
>
> ---------------------------------------------------------------------
> 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