hi ralph Goers,
Thank you for your reply.I go through the refered site and i try to
implement it.Intially i used log4j.properties file.Now i replaced that with
log4j.xml
In my Program i used DOMConfigurator.configure("D:/log4j.xml");
now it throws new Error.
log4j:WARN No appenders could be found for logger (com.log.ClassLogger).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for
more info.
And im enable to get through it
can u please hepl me to finish it
Thank in advance
Adi
Ralph Goers wrote:
>
> I found this link which seems to be exactly on topic -
> http://www.coderanch.com/t/62444/open-source/log-properties.
>
> The short answer is that you want to use the LevelMatchFilter but that can
> only be used with an XML configuration.
>
> Ralph
>
>
> On Aug 22, 2012, at 6:54 AM, adicj wrote:
>
>>
>> hi all,
>>
>> Im new to log4j.i am trying to log the Info and error into two different
>> files.
>> here is my log4j.properties file
>>
>> # Direct info log messages to a log file
>> log4j.appender.infofile=org.apache.log4j.RollingFileAppender
>> log4j.appender.infofile.File=C\:\\infologing.log
>> log4j.appender.infofile.MaxFileSize=1MB
>> log4j.appender.infofile.MaxBackupIndex=10
>> log4j.appender.infofile.layout=org.apache.log4j.PatternLayout
>> log4j.appender.infofile.layout.ConversionPattern=%d{ABSOLUTE} %5p
>> %c{1}:%L -
>> %m%n
>> log4j.appender.infofile.Threshold=info
>>
>> # Direct error log messages to a log file
>> log4j.appender.errorfile=org.apache.log4j.RollingFileAppender
>> log4j.appender.errorfile.File=C\:\\errorloging.log
>> log4j.appender.errorfile.MaxFileSize=1MB
>> log4j.appender.errorfile.MaxBackupIndex=10
>> log4j.appender.errorfile.layout=org.apache.log4j.PatternLayout
>> log4j.appender.errorfile.layout.ConversionPattern=%d{ABSOLUTE} %5p
>> %c{1}:%L
>> - %m%n
>> log4j.appender.errorfile.Threshold=error
>>
>> # Direct log messages to stdout
>> log4j.appender.stdout=org.apache.log4j.ConsoleAppender
>> log4j.appender.stdout.Target=System.out
>> log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
>> log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L
>> -
>> %m%n
>> log4j.appender.stdout.Threshold=info
>>
>> # Root logger option
>> log4j.rootLogger=info, infofile, errorfile
>>
>> But my infologing.log look like
>>
>> 19:05:39,028 ERROR ClassLogger:27 - error message 1
>> 19:05:39,059 INFO ClassLogger:28 - well done
>> 19:05:39,090 INFO ClassLogger:29 - try it again @ :Wed Aug 22 19:05:39
>> IST
>> 2012
>> 19:05:39,090 ERROR ClassLogger:30 - error message 2
>>
>> But the errorloging.log is Working fine Like
>>
>> 19:05:39,028 ERROR ClassLogger:27 - error message 1
>> 19:05:39,090 ERROR ClassLogger:30 - error message 2
>>
>> This is my ClassLogger.java
>>
>> public static void main(String[] args) {
>> // TODO Auto-generated method stub
>> Logger
>> logger=Logger.getLogger(ClassLogger.class.getCanonicalName());
>>
>> // this is to Locate Properties File******************
>>
>> PropertyConfigurator.configure("D:\\Workspace\\LoggerSample\\src\\log4j.properties");
>>
>> logger.error("error message 1");
>> logger.info("well done");
>> logger.info("try it again @ :"+new Date().toString());
>> logger.error("error message 2");
>> }
>>
>> Please help me to solve this issue by gettting "info" Log only in
>> "infofile.log" file
>>
>> Thanks in Advance
>> Adi
>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/Log4j-%3A-how-to-classify-loger-messages-tp34334503p34334503.html
>> Sent from the Log4j - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>
>
>
--
View this message in context:
http://old.nabble.com/Log4j-%3A-how-to-classify-loger-messages-tp34334503p34338945.html
Sent from the Log4j - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]