logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jacob Kjome" <h...@visi.com>
Subject Re: Wanted: Help finding documentation
Date Wed, 05 Aug 2009 15:44:59 GMT
Have you tried a search engine?  Seriously, there are lots of tutorials out 
there on using Log4j.

As for the config files, Log4j will auto-configure itself if you place 
log4j.properties or log4j.xml in the default package, i.e, no package.

As far as changing the configuration at runtime, you can configure manually 
using configureAndWatch() (not recommended) or use a servlet to manage this.  
There used to be a utility called LogWeb that seems to longer exist, though if 
you are lucky you might find an old release sitting out there somewhere.  I 
think there are commercial solutions out there as well.  The Log4j sandbox has 
a basic dynamic configuration servlet and Log4j ships with a JMX module that 
I've never attempted to use.  In any case, there are options.

Jake


On Wed, 5 Aug 2009 17:27:22 +0700
  Alexander <the.malkolm@gmail.com> wrote:
> Hi,
> 
> Everything could be done with log4j.properties. Configuration could be
> changed in runtime.
> Log4j have limited site documentation. Complete documentation available in
> book. Find this book
> http://www.amazon.com/Complete-Log4j-Manual-Ceki-Gulcu/dp/2970036908 [?]
> 
> <http://www.amazon.com/Complete-Log4j-Manual-Ceki-Gulcu/dp/2970036908>
> Regards,
> Alexander
> 
> 2009/8/5 siegfried <siegfried@heintze.com>
> 
>> Can someone kindly provide me with the URL that explains how I can enhance
>> my program below to
>>
>> 1.      Turn on and off various levels of logging (eg: turn on info logging
>> but turn off debug logging)
>> 2.      Display the logs somewhere besides standard output?
>>
>>
>>
>> I have read http://logging.apache.org/log4j/1.2/manual.html and it appears
>> this can be done on tomcat using a log4jconfiguration file. That is what I
>> want to do with my sample program below. Where do I put such a file and
>> what
>> is it called? Can I make it write to a socket instead of a file? How would
>> I
>> read it then?
>>
>>
>>
>> Now with the other projects like xalan and xerces, you can download them
>> and
>> you get some sample source code. OK, so I am supposed to use maven. How do
>> I
>> download the examples? The FAQ references "examples/Sort.java example and
>> associated configuration files"  but I cannot find them. I found a
>> reference
>> to some example source code for XML at
>> http://logging.apache.org/log4j/1.2/apidocs/index.html but the link was
>> bad!
>>
>>
>>
>> Do I have to buy the $20 manual just to make a trivial example work?
>>
>>
>>
>> Thanks,
>>
>> Siegfried
>>
>>
>>
>> package world;
>>
>> import org.apache.commons.logging.Log;
>>
>> import org.apache.commons.logging.LogFactory;
>>
>>
>>
>> public class HelloJavaWorld {
>>
>>    private static final Log log = LogFactory.getLog(HelloJavaWorld.class);
>>
>>            public HelloJavaWorld() {
>>
>>                        log.debug("begin debug HelloJavaWorld ctor");
>>
>>                        log.info("begin info HelloJavaWorld ctor");
>>
>>                        // TODO Auto-generated constructor stub
>>
>>                        log.info("end HelloJavaWorld ctor");
>>
>> }
>>
>>
>>
>>            /**
>>
>>             * @param args
>>
>>             */
>>
>>            public static void main(String[] args) {
>>
>>                        log.debug("begin main");
>>
>>                        System.out.println("hello world;");
>>
>>                        log.info("end main");
>>
>>            }
>>
>>
>>
>> }
>>
>>
> 
> 
> -- 
> Alexander


---------------------------------------------------------------------
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