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 Madhava Reddy <Ma...@icon-scm.com> on 2003/02/01 15:04:26 UTC

RE: Hi Guys

Vijay,

I'm splitting logs according to debug levels. It works fine, but I'm not
sure whether it's how it needs to be done.. 

Here is sample of xml confuguration file I'm using.

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">

    <appender name="DebugLog"
        class="org.apache.log4j.DailyRollingFileAppender">
        <param name="File"
            value="D:/tomcat4110/logs/Debug.log"/>
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d %-5p
            %m%n"/>
        </layout>
    </appender>

    <appender name="InfoLog"
        class="org.apache.log4j.DailyRollingFileAppender">
        <param name="File"
            value="D:/tomcat4110/logs/Info.log"/>
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d %-5p
            %m%n"/>
        </layout>
    </appender>
	
    <logger name="Debug">
        <level value="debug"/>
        <appender-ref ref="DebugLog"/>
    </logger>

  <logger name="Info">
        <level value="info"/>
        <appender-ref ref="InfoLog"/>
    </logger>
   
    <root>
        <priority value="debug"/>
    </root>

</log4j:configuration>

Hope this helps you

regards
Madhav


-----Original Message-----
From: vijay reddy [mailto:vijayreddy50@yahoo.com]
Sent: Friday, January 31, 2003 10:07 PM
To: Log4J Users List
Subject: Hi Guys


Hi,

    Do i need to change programatically or if i change
property file or xml is it going to work.

Thanks,
Vijay

> 
> Anyway, see the Javadoc for
> org.apache.log4j.varia.LevelMatchFilter
> 
> <filter
> class="org.apache.log4j.varia.LevelMatchFilter">
>    <param name="LevelToMatch" value="DEBUG" />
>    <param name="AcceptOnMatch" value="true" />
> </filter> 
> 
> ...or something like that
> 
> []'s
> Daniel Serodio
> 
> On Fri, 2003-01-31 at 17:45, vijay reddy wrote:
> > HI ,
> > 
> >    I want to generate 5 log files depends on
> levels in
> > the same class.
> > (ex:  Logger logger =
> Logger.getLogger("com.abcd");
> >   logger.debug("debug message");
> > 
> > 1. debug message will go to debug.log,
> > 2. error messages will go to error.log, 
> > 3. Info messages will go to info.log,
> > 4. warn messages will go warn.log, 
> > 5. fatal messages will go to fatal.log.
> > Is it possible by using Log4j.Can you suggest me.
> > 
> > Thanks,
> > Vijay
> > 
> > 
> > 
> > 
> > 
> > __________________________________________________
> > Do you Yahoo!?
> > Yahoo! Mail Plus - Powerful. Affordable. Sign up
> now.
> > http://mailplus.yahoo.com
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> log4j-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> log4j-user-help@jakarta.apache.org
> -- 
> Daniel Serodio <da...@checkforte.com.br>
> CheckForte
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> log4j-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> log4j-user-help@jakarta.apache.org
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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

RE: Hi Guys

Posted by vijay reddy <vi...@yahoo.com>.
Hi Guys,

      Using filers it is working fine...

Thanks,
Vijay


--- Madhava Reddy <Ma...@icon-scm.com> wrote:
> Vijay,
> 
> I'm splitting logs according to debug levels. It
> works fine, but I'm not
> sure whether it's how it needs to be done.. 
> 
> Here is sample of xml confuguration file I'm using.
> 
> <log4j:configuration
> xmlns:log4j="http://jakarta.apache.org/log4j/">
> 
>     <appender name="DebugLog"
>        
> class="org.apache.log4j.DailyRollingFileAppender">
>         <param name="File"
>             value="D:/tomcat4110/logs/Debug.log"/>
>         <layout
> class="org.apache.log4j.PatternLayout">
>             <param name="ConversionPattern"
> value="%d %-5p
>             %m%n"/>
>         </layout>
>     </appender>
> 
>     <appender name="InfoLog"
>        
> class="org.apache.log4j.DailyRollingFileAppender">
>         <param name="File"
>             value="D:/tomcat4110/logs/Info.log"/>
>         <layout
> class="org.apache.log4j.PatternLayout">
>             <param name="ConversionPattern"
> value="%d %-5p
>             %m%n"/>
>         </layout>
>     </appender>
> 	
>     <logger name="Debug">
>         <level value="debug"/>
>         <appender-ref ref="DebugLog"/>
>     </logger>
> 
>   <logger name="Info">
>         <level value="info"/>
>         <appender-ref ref="InfoLog"/>
>     </logger>
>    
>     <root>
>         <priority value="debug"/>
>     </root>
> 
> </log4j:configuration>
> 
> Hope this helps you
> 
> regards
> Madhav
> 
> 
> -----Original Message-----
> From: vijay reddy [mailto:vijayreddy50@yahoo.com]
> Sent: Friday, January 31, 2003 10:07 PM
> To: Log4J Users List
> Subject: Hi Guys
> 
> 
> Hi,
> 
>     Do i need to change programatically or if i
> change
> property file or xml is it going to work.
> 
> Thanks,
> Vijay
> 
> > 
> > Anyway, see the Javadoc for
> > org.apache.log4j.varia.LevelMatchFilter
> > 
> > <filter
> > class="org.apache.log4j.varia.LevelMatchFilter">
> >    <param name="LevelToMatch" value="DEBUG" />
> >    <param name="AcceptOnMatch" value="true" />
> > </filter> 
> > 
> > ...or something like that
> > 
> > []'s
> > Daniel Serodio
> > 
> > On Fri, 2003-01-31 at 17:45, vijay reddy wrote:
> > > HI ,
> > > 
> > >    I want to generate 5 log files depends on
> > levels in
> > > the same class.
> > > (ex:  Logger logger =
> > Logger.getLogger("com.abcd");
> > >   logger.debug("debug message");
> > > 
> > > 1. debug message will go to debug.log,
> > > 2. error messages will go to error.log, 
> > > 3. Info messages will go to info.log,
> > > 4. warn messages will go warn.log, 
> > > 5. fatal messages will go to fatal.log.
> > > Is it possible by using Log4j.Can you suggest
> me.
> > > 
> > > Thanks,
> > > Vijay
> > > 
> > > 
> > > 
> > > 
> > > 
> > >
> __________________________________________________
> > > Do you Yahoo!?
> > > Yahoo! Mail Plus - Powerful. Affordable. Sign up
> > now.
> > > http://mailplus.yahoo.com
> > > 
> > >
> >
>
---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > log4j-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail:
> > log4j-user-help@jakarta.apache.org
> > -- 
> > Daniel Serodio <da...@checkforte.com.br>
> > CheckForte
> > 
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > log4j-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > log4j-user-help@jakarta.apache.org
> > 
> 
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up
> now.
> http://mailplus.yahoo.com
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> log4j-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> log4j-user-help@jakarta.apache.org
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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


RE: Hi Guys

Posted by vijay reddy <vi...@yahoo.com>.
Hi Madhav,

      I used u r xml file, i am getting error 
"log4j:WARN No appenders could be found for logger"

In xml root
 i added the following line
<appender-ref ref="InfoLog"/>
<appender-ref ref="DebugLog"/>
it will look like this

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration
xmlns:log4j='http://jakarta.apache.org/log4j/'>

    <appender name="DebugLog"
class="org.apache.log4j.DailyRollingFileAppender">
        <param name="File" value="Debug.log"/>
        <layout
class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d
%-5p %m%n"/>
        </layout>
    </appender>

    <appender name="InfoLog"
class="org.apache.log4j.DailyRollingFileAppender">
        <param name="File" value="Info.log"/>
        <layout
class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d
%-5p %m%n"/>
        </layout>
    </appender>
	
    <logger name="Debug">
        <level value="debug"/>
        <appender-ref ref="DebugLog"/>
    </logger>

  <logger name="Info">
        <level value="info"/>
        <appender-ref ref="InfoLog"/>
    </logger>
   
    <root>
        <priority value="debug"/>     
           <appender-ref ref="InfoLog"/>
           <appender-ref ref="DebugLog"/>
    </root>

</log4j:configuration>





still i am getting all messages into two log files
such as

2003-02-01 14:20:46,074 INFO   
2003-02-01 14:20:46,084 WARN  
2003-02-01 14:20:46,084 DEBUG  
2003-02-01 14:20:46,084 ERROR  

      My requirement is i want to send INFO message to
one log file, warn to one log file, DEBUG to one log
file and ERROR to one log file.I don't want to all the
messages in the single file.

Thanks,
Vijay
  



--- Madhava Reddy <Ma...@icon-scm.com> wrote:
> Vijay,
> 
> I'm splitting logs according to debug levels. It
> works fine, but I'm not
> sure whether it's how it needs to be done.. 
> 
> Here is sample of xml confuguration file I'm using.
> 
> <log4j:configuration
> xmlns:log4j="http://jakarta.apache.org/log4j/">
> 
>     <appender name="DebugLog"
>        
> class="org.apache.log4j.DailyRollingFileAppender">
>         <param name="File"
>             value="D:/tomcat4110/logs/Debug.log"/>
>         <layout
> class="org.apache.log4j.PatternLayout">
>             <param name="ConversionPattern"
> value="%d %-5p
>             %m%n"/>
>         </layout>
>     </appender>
> 
>     <appender name="InfoLog"
>        
> class="org.apache.log4j.DailyRollingFileAppender">
>         <param name="File"
>             value="D:/tomcat4110/logs/Info.log"/>
>         <layout
> class="org.apache.log4j.PatternLayout">
>             <param name="ConversionPattern"
> value="%d %-5p
>             %m%n"/>
>         </layout>
>     </appender>
> 	
>     <logger name="Debug">
>         <level value="debug"/>
>         <appender-ref ref="DebugLog"/>
>     </logger>
> 
>   <logger name="Info">
>         <level value="info"/>
>         <appender-ref ref="InfoLog"/>
>     </logger>
>    
>     <root>
>         <priority value="debug"/>
>     </root>
> 
> </log4j:configuration>
> 
> Hope this helps you
> 
> regards
> Madhav
> 
> 
> -----Original Message-----
> From: vijay reddy [mailto:vijayreddy50@yahoo.com]
> Sent: Friday, January 31, 2003 10:07 PM
> To: Log4J Users List
> Subject: Hi Guys
> 
> 
> Hi,
> 
>     Do i need to change programatically or if i
> change
> property file or xml is it going to work.
> 
> Thanks,
> Vijay
> 
> > 
> > Anyway, see the Javadoc for
> > org.apache.log4j.varia.LevelMatchFilter
> > 
> > <filter
> > class="org.apache.log4j.varia.LevelMatchFilter">
> >    <param name="LevelToMatch" value="DEBUG" />
> >    <param name="AcceptOnMatch" value="true" />
> > </filter> 
> > 
> > ...or something like that
> > 
> > []'s
> > Daniel Serodio
> > 
> > On Fri, 2003-01-31 at 17:45, vijay reddy wrote:
> > > HI ,
> > > 
> > >    I want to generate 5 log files depends on
> > levels in
> > > the same class.
> > > (ex:  Logger logger =
> > Logger.getLogger("com.abcd");
> > >   logger.debug("debug message");
> > > 
> > > 1. debug message will go to debug.log,
> > > 2. error messages will go to error.log, 
> > > 3. Info messages will go to info.log,
> > > 4. warn messages will go warn.log, 
> > > 5. fatal messages will go to fatal.log.
> > > Is it possible by using Log4j.Can you suggest
> me.
> > > 
> > > Thanks,
> > > Vijay
> > > 
> > > 
> > > 
> > > 
> > > 
> > >
> __________________________________________________
> > > Do you Yahoo!?
> > > Yahoo! Mail Plus - Powerful. Affordable. Sign up
> > now.
> > > http://mailplus.yahoo.com
> > > 
> > >
> >
>
---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > log4j-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail:
> > log4j-user-help@jakarta.apache.org
> > -- 
> > Daniel Serodio <da...@checkforte.com.br>
> > CheckForte
> > 
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > log4j-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > log4j-user-help@jakarta.apache.org
> > 
> 
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up
> now.
> http://mailplus.yahoo.com
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> log4j-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> log4j-user-help@jakarta.apache.org
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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