logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MY POI <vrkrajeshr...@yahoo.co.in>
Subject Re: HOw to replace the system.out.println
Date Tue, 02 Sep 2008 12:34:30 GMT

Thanks a lot..but here we are having hundreads of classes..

in this case any solution is there

thanks



Ognjen Blagojevic wrote:
> 
> MY POI wrote:
>> Dear all
>> 
>>            I want to use the logging system in my Project which consist
>> of
>> many modules developing by the 
>> 
>> much developers. Here I need to replace system.out.println statements and
>> i
>> want put loggers.
>> 
>> Is there any way to configuring one property file to replace the
>> statements.
>> 
>> Many thanks in advance
>> Rajesh
> 
> At the beginning of every class you should put:
> 
>    private static Logger logger = Logger.getLogger(ClassName.class);
> 
> Than, instead of
> 
>    System.out.println("...");
> 
> use
> 
>    logger.logMethod("...")
> 
> where logMethod is info/warning/debug etc.
> 
> In the end, put log4j.properties in the src.folder:
> 
> ------log4j.properties------
> log4j.rootLogger=info, stdout
> 
> log4j.appender.stdout=org.apache.log4j.ConsoleAppender
> log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
> log4j.appender.stdout.layout.ConversionPattern=%m%n
> ----------------------------
> 
> That should be enough to begin working.
> 
> Regards,
> Ognjen
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/HOw-to-replace-the-system.out.println-tp19232652p19269344.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


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


Mime
View raw message