logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "siegfried" <siegfr...@heintze.com>
Subject Wanted: Help finding documentation
Date Wed, 05 Aug 2009 07:00:07 GMT
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?





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");




  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message