6 Replies Latest reply on Sep 6, 2002 7:00 AM by Adrian Brock

    How to create a log for my application

    Thomas Hollfelder Newbie

      Hi to All,

      sorry for asking a beginners question.

      I want to create a logfile for logging application-specific things. I saw the log4j.xml and how to setup a DailyRollingFileAppender but how do I access that logger?
      I just tried the following code in one of my classes:
      Logger log=Logger.getLogger("FILE");
      log.info("Hallo das war der Logger");
      log=Logger.getLogger("CONSOLE");
      log.info("Hallo das ist der Logger");

      and I see in both (the File and the console):
      16:39:45,433 INFO [FILE] Hallo das war der Logger
      16:39:45,433 INFO [CONSOLE] Hallo das ist der Logger

      How to log things only in the file and other things to the console
      or if I create my own Logfile in log4j.xml, how to access the Logger for that?

      Thanks,

      Thomas