-
1. Re: jboss-6.1.0 Final + Log4J SyslogAppender
white_sox Mar 1, 2012 1:16 PM (in response to white_sox)The problem is with the org.apache.log4j.net.SyslogAppender class. The class is only handling part of the message, ignoring information such as timestamp and debug level.
The solution is to extend the class and override the handling methods. -
2. Re: jboss-6.1.0 Final + Log4J SyslogAppender
rbreault73 Apr 10, 2012 5:59 PM (in response to white_sox)I see you say the solution is to extend the class and override the handling methods? Is this also true for Jboss-5.0.0GA as I have also set this up and get the following
Run this for a test
logger –p local0.warning “This space intentionally left blank”
Then look at my remote system and have the following
2012-04-10T15:50:26-06:00 atgbcc1 root: –p local0.warning “This space intentionally left blank”
So I can see that I can write to that log without issues.
I have setup my jboss-log4j.xml as so
<appender name="SYSLOG" class="org.apache.log4j.net.SyslogAppender">
<errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
<param name="Facility" value="local0"/>
<param name="FacilityPrinting" value="true"/>
<param name="Header" value="true"/>
<param name="SyslogHost" value="localhost"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-4r [%t] %-5p %X{profileId} %X{orderId} %X{sessionId} %c %x - %m%n"/>
</layout>
</appender>
So I am curious if I just missed something or if I have do as you post extend the class which I am not sure how to do.
Thanks,
Rob
-
3. Re: jboss-6.1.0 Final + Log4J SyslogAppender
white_sox Apr 11, 2012 5:34 AM (in response to rbreault73)My post refers to 6.1.0. I don't know about Jboss-5.0.0GA .
If you're not receiving the full Log4jJ message on syslog, you problably will have to extend the org.apache.log4j.net.SyslogAppender class and override the "append" method.
You do this by creating a new JAR where you extend the class and override the method, such as:
public class NewLog4jAppender extends SyslogAppender {
@Override
public void append(LoggingEvent event) {
........ (create newEvent)
super.append(newEvent)
}
You can extract the log information from the event parameter and create a new LoggingEvent where you add all the data you need. Then you call the append from the parent class.
After doing this, you'll have to call your new class on jboss-log4j.xml:
<appender name="SYSLOG" class="NewLog4jAppender">
Hope this helps