You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Ian Marlier <ma...@studentuniverse.com> on 2004/04/21 03:05:39 UTC

Error in setting up syslogging

Hey all --

I'm trying to setup log4j to log to syslog on a remote machine, a log server
that collects all kinds of logs from all over the place...

I've got the conf file set up correctly (I think), but when I try to start
up the server (jboss) I get the following error:

20:54:24,874 ERROR [Server] Failed to start
java.lang.NullPointerException
        at 
org.apache.log4j.net.SyslogAppender.append(SyslogAppender.java:241)
        at 
org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:221)
        at 
org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(Append
erAttachableImpl.java:57)
        at org.apache.log4j.Category.callAppenders(Category.java:187)
        at org.apache.log4j.Category.forcedLog(Category.java:372)
        at org.apache.log4j.Category.log(Category.java:864)
        at 
org.jboss.logging.Log4jLoggerPlugin.error(Log4jLoggerPlugin.java:205)
        at org.jboss.logging.Logger.error(Logger.java:216)
        at org.jboss.deployment.MainDeployer.create(MainDeployer.java:797)
        at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:639)
        at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:613)
        at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:597)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at 
org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispat
cher.java:284)
        at 
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
        at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
        at $Proxy6.deploy(Unknown Source)
        at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:365)
        at org.jboss.system.server.ServerImpl.start(ServerImpl.java:272)
        at org.jboss.Main.boot(Main.java:150)
        at org.jboss.Main$1.run(Main.java:388)
        at java.lang.Thread.run(Thread.java:534)
20:54:24,880 ERROR [STDERR] Failed to boot JBoss:
ERROR: invalid console appender config detected, console stream is
looping20:54:24,928 INFO  [Server] JBoss SHUTDOWN: Undeploying all packages
20:54:24,929 ERROR [STDERR] java.lang.NullPointerException





The system is RedHat 9, with jboss as the application server.  The relevant
portion of the configuration file is:

  <!-- ============================= -->
  <!-- SYSLOG Appender  (system.out) -->
  <!-- ============================= -->
<appender name="SYSLOG" class="org.apache.log4j.net.SyslogAppender">
        <param name="Facility" value="local5"/>
        <param name="FacilityPrinting" value="true"/>
        <param name="SyslogHost" value="localhost"/>
</appender>


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Error in setting up syslogging

Posted by shashikiran <ms...@rediffmail.com>.
Hi Ian,

The problem is because of not specifying the layout for the SyslogAppender.
I faced the same problem and on looking into the SysLogAppender class, I found 
out a method called requiresLayout() which returned true indicating that this 
Appender mandatorily requires to have a layout.

Sample log4j.xml : 

       <appender name="SYSLOG" class="org.apache.log4j.net.SyslogAppender">  
         <param name="Facility" value="LOCAL7"/>  
        <param name="FacilityPrinting" value="true"/>  
         <param name="SyslogHost" value="192.168.136.33"/>  
         <layout class="org.apache.log4j.PatternLayout">
	     <param name="ConversionPattern" value="%d  [%-5p] %-6r %x - %m%n"/>
     	</layout>
       </appender>  

Regards,
-Shashi




---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org