landsLog4j - Initilization Requirement - posted by pwc@u.washington.edu Log4j issues message "Please initialize the log4j system properly". Log4j might want to request such initialization but it should nonetheless, perform a default init BasicConfigurator.configure (); and give the user the messages that he wanted to log without mandating.


Log4j - Documentation request - posted by djaquay@yahoo.com

Getting started with the simplest log4j setup requires three lines of code:

BasicConfigurator.configure();
Logger logger = Logger.getLogger( MyClass.class );
logger.debug( "your message here" );

There should be a quickstart page in the docs that says this. (Actually, I was quite annoyed at having to wade through the short manual and API docs to figure this out, when I was deciding whether or not I wanted to use log4j; I ranted about it on my blog here: http://javadave.blogspot.com/2006/04/setting-up-log4j.html)


Log4j - Logging as RSS or Atom - posted by thompsonbry@users.sourceforge.net

Add a new appender that outputs RSS. This would support the aggregation of application events through existing RSS syndication and aggregation mechanisms A trivial variant could output Atom instead of RSS.

The concept of an XML Layout tool would seem a better way to approach this, but the current XMLLayout class uses a constrained XML vocabulary, so it can't be configured for general XML document production. So perhaps this should be realized by an RssLayout and AtomLayout class which would maintain the separation of concerns from the appender logic.


Log4J - AsyncAppender - posted by marc.oesch@gmx.net Additional/optional parameter which defines a time (in seconds) to pause after subsequent waves of logEvents are released to the Appenders (and if not yet available specifiy the size of the circular buffer). In combination with an SMTPAppender this avoids to have mail flooding. Events can be grouped in mail messages. In my opinion only very small changes need to be done to the AsyncAppender like for ex.: Run method in inner class Dispatcher

public void run() {

    //Category cat = Category.getInstance(Dispatcher.class.getName());

    LoggingEvent event;
>>  long lastCycle = 0L;

    while(true) {
      synchronized(bf) {
        if(bf.length() == 0) {
          // Exit loop if interrupted but only if the the buffer is empty.
          if(interrupted) {
            //cat.info("Exiting.");
            break;
          }
          try {
            //LogLog.debug("Waiting for new event to dispatch.");
            bf.wait();
            // wait at least a given amount of time: waitMin. Interesting
            // if the appender are mail or messaging appenders
            // waitMin optional by configuration settings or 0
            // would be usefull to test if buffer is full before waiting more time
>>            if((System.currentTimeMillis() - lastCycle)/1000 < waitMin)
>>                bf.wait(waitMin*1000 -(System.currentTimeMillis()-lastCycle);
          } catch(InterruptedException e) {
            LogLog.error("The dispatcher should not be interrupted.");
            break;
          }
        }
...more lines
        if(aai != null && event != null) {
          aai.appendLoopOnAppenders(event);
        }
      }
>>      lastCycle = System.currentTimeMillis();
    } // while


Log4J - Requested Features


LogFactor 5 - Requested Features

Log4jRequestedFeatures (last edited 2012-10-07 17:48:03 by RalphGoers)