Logmanager documentation
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Log4j

Log4j is used to retrieve logs from Java applications. Logs from Log4j can be sent to the Logmanager server via Syslog protocol.

Log4j version 1

  1. You need to find the configuration file for Log4j in the Java application. It is typically saved as logging.properties file or log4j.properties file.

  2. Edit the configuration file:

    rootLogger = DEBUG, udp
    
    appender.udp = org.apache.log4j.receivers.net.UDPAppender
    appender.udp.RemoteHost = <Logmanager_IP_address>
    appender.udp.port = 514
    appender.udp.layout.type = org.apache.log4j.PatternLayout
    appender.udp.layout.ConversionPattern = java %d{yyyy-MM-dd HH:mm:ss,SSS}{GMT} %p %t %c %M - %m%n
    
    Logmanager_IP_address is the IP address your Logmanager server.
  3. Restart the Java application to load the new configuration file.

  4. You can now continue by configuring classifiers and parser on the Logmanager server.

Log4j version 2

  1. You need to find the configuration file for Log4j2 in the Java application. It is typically saved as logging.properties file or log4j2.properties file.

  2. Edit the configuration file:

    appender.socket.type = Socket
    appender.socket.name = socket
    appender.socket.host = <Logmanager_IP_adresa>
    appender.socket.port = 514
    appender.socket.protocol = UDP
    appender.socket.layout.type = PatternLayout
    appender.socket.layout.pattern = ${hostName} java %d{yyyy-MM-dd HH:mm:ss,SSS}{GMT} %p %t %c %M - %m%n
    
    rootLogger.level = debug
    rootLogger.appenderRef.socket.ref = socket
    
    Logmanager_IP_address is the IP address your Logmanager server.
  3. Restart the Java application to load the new configuration file.

  4. You can now continue by configuring classifiers and parser on the Logmanager server.