Discussions

General J2EE: Help:Log4j for NT EventLog

  1. Help:Log4j for NT EventLog (2 messages)

    Does any body did any work for NT eventlog appender.
    I like my one of the appender to be NT Eventlog viewer.
    How can I do it. Any sample code
  2. U can log to windows event que using log4j.
    There is a class called NTEventLogAppender for this

    here is the sample code below

    logger = Logger.getLogger(DRMWinLogger.class);
    PatternLayout layout = new PatternLayout(sbPattern.toString());
    NTEventLogAppender ntel = new NTEventLogAppender("DRM",layout);
    logger.addAppender(ntel);

    here sbPattern is the string buffer that contains the pattern for logging

    besides all these u have to place a dll file to the winnt\system32.This file is provided with log4j distribution.Then name of DLL is "NTEventLogAppender.dll"


    That is it
  3. thanks Sri,
    I am using log4j.properties file.
    When I copied the dll it was in system dir instead of system32.
    I moved it started working.
    It start to load the properties file.