• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Help log4j SysLogAppender

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am not able to write the log messages in the syslog server (particularly I need to write in the messages log file) and Pls find the code below and I dont know wht missed out


package com.test.syslog;

import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;

public class TestSyslog {

static Logger log = Logger.getLogger("TestSyslog");

public static void main(String args[]) {
PropertyConfigurator.configure("D:/src/com/test/syslog/log4j.properties");
log.debug("This is my debug message.");
log.info("This is my info message.");
log.warn("This is my warn message.");
log.error("This is my error message.");
log.fatal("This is my fatal message.");
}
}


config file

log4j.rootLogger=INFO, A1
log4j.appender.A1=org.apache.log4j.net.SyslogAppender
log4j.appender.A1.SyslogHost=127.0.0.1
log4j.appender.A1.facility=MAIL
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-4r %-5p %c{2} %M.%L %x - %m\n


Thanks in advance
 
Lookout! Runaway whale! Hide behind this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic