How to Configure Grails application for sending your application logs to Loggly using log4j SyslogAppender.
Posted By : Sanjay Saini | 27-Sep-2014
Hi Friends,
In this blog ,I am going to explain you how to Send your application logs to Loogly using Log4j syslog appender. The SyslogAppender will send them to your existing syslog daemon, which will then send them to Loggly. We automatically parse out several log4j fields.
Following Steps must be followed for sending application Logs to loggly.
Step 1 : Configure Rsyslog .
If you haven't already, please follow instruction defined in previous blog for Configure Rsyslog in Linux for sending Linux Systems Logs to Loggly.
please follow the above link instructions to configure Rsyslog in linux .
Step 2 : Open rsyslog.conf file in vim editor command for open :
sudo vim /etc/rsyslog.conf
Enable UDP input by uncommenting these lines from rsyslog.conf file
$ModLoad imudp $UDPServerRun 514
save changes and restart rsyslog.
Step 3 : Edit Config.groovy file for Configure Log4j in grails Application.
Path of config file---->applicationName/grails-app/conf/config.groovy
Dowanload org.apache.log4j.net jar and add on your build path.
import it in config.groovy file.
import org.apache.log4j.net.SyslogAppender
Copy and paste below code inside
log4j{ appenders{ appender new SyslogAppender( name: 'syslog', facility: 'LOCAL3', syslogHost: 'localhost', header:true, layout: pattern(conversionPattern: 'java %d{dd-MM-yyyy HH:mm:ss,SSS} %5p %c{2} - %m%n') ) root{ debug 'syslog' } } }
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Sanjay Saini
Sanjay has been working on web application development using frameworks like Java, groovy and grails. He loves listening to music , playing games and going out with friends in free time.