Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

How do i configure jboss to log to syslog?

share|improve this question

2 Answers 2

Putting something like:

 <!-- Syslog events -->  <appender name="SYSLOG" class="org.apache.log4j.net.SyslogAppender">  <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>  <param name="Facility" value="LOCAL7"/>  <param name="FacilityPrinting" value="true"/>  <param name="SyslogHost" value="localhost"/>  <layout class="org.apache.log4j.PatternLayout">  <param name="ConversionPattern" value="[%d{ABSOLUTE},%c{1}] %m%n"/>  </layout>  </appender>

in your log4j.conf would work... Just make sure to tune it down to what you actually want, just uses standard log4j context, you definitely wouldn't want all of your jvm logs to be spitting out to syslog in most app server configs...

share|improve this answer
    
where do i put log4j.conf? there isn't one by default in jboss 7 =/ –  Carl Hörberg Jan 19 '12 at 16:15
1  
See this link: community.jboss.org/wiki/Logging –  Doug Jan 19 '12 at 19:16

I am using this: https://github.com/kifj/jboss-syslog

     <profile>
         <subsystem xmlns="urn:jboss:domain:logging:1.2">
+               <custom-handler name="SYSLOG" class="x1.jboss.syslog.SyslogHandler"     module="x1.jboss-syslog">
+                       <level name="INFO"/>
+                       <properties>
+                           <property name="loghost" value="localhost"/>
+                           <property name="application" value="jboss-as7"/>
+                       </properties>
+               </custom-handler>
             <console-handler name="CONSOLE">
                 <level name="INFO"/>
                 <formatter>
@@ -89,8 +100,7 @@
             <root-logger>
                 <level name="INFO"/>
                 <handlers>
-                    <handler name="CONSOLE"/>
-                    <handler name="FILE"/>
+                    <handler name="SYSLOG"/>
                 </handlers>
             </root-logger>
         </subsystem>

for access log it still does not work. the tag wants to write to file, and have no idea how to use a custom logger there.

share|improve this answer
    
Hi and Welcome to Serverfault! Please read the How to Answer a Question Guide. This site is a Q&A site not a forum. –  slm Apr 12 '13 at 10:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.