
Hi, I have following requirements when sending the log from a java web application to syslog server: 1. When logging the stack trace in case of exceptions, all the stack strace should be seen as a single message. 2. Need to send either or all of the following information in logs- name of the web application, URL, version of the application. As per my knowledge, Syslog appender of Logback doesnot fit to above requirements. I am also looking for any other logging APIs which can satisfy these requirements. Any ideas? Thanks in advance. - Pradnya

On 22.10.2010 17:02, Pradnya Gawade wrote:
Hi,
I have following requirements when sending the log from a java web application to syslog server:
1. When logging the stack trace in case of exceptions, all the stack strace should be seen as a single message.
Logback does not support this feature. Please create a jira issue asking for it.
2. Need to send either or all of the following information in logs- name of the web application, URL, version of the application.
Via MDC ======= Add the following code when your web-app starts: MDC.put("appName", ...); MDC.put("appURL", ...); MDC.put("appVersion", ...); In logback.xml: <appender name="SYSLOG" class="ch.qos.logback.classic.net.SyslogAppender"> <SuffixPattern>%mdc{appName} %mdc{appURL} %mdc{appVersion} %logger %msg</SuffixPattern> </appender> By system properties ==================== Set the following system properties: -DappName=... -DappURL=... -DappVersion In logback.xml: <appender name="SYSLOG" class="ch.qos.logback.classic.net.SyslogAppender"> <SuffixPattern>%property{appName} %property{appURL} %property{appVersion} %logger %msg</SuffixPattern> </appender> HTH
As per my knowledge, Syslog appender of Logback doesnot fit to above requirements. I am also looking for any other logging APIs which can satisfy these requirements. Any ideas? Thanks in advance.
- Pradnya

Thanks a lot Ceki Gulcu. I will follow your instructions. Do you know about any other logging APIs for jav which can support both these requirement? I am lokking at Protomatter syslog which probably can help but it looks complicated to implement compared to Logback. - Pradnya On Fri, Oct 22, 2010 at 11:17 AM, Ceki Gulcu <ceki@qos.ch> wrote:
On 22.10.2010 17:02, Pradnya Gawade wrote:
Hi,
I have following requirements when sending the log from a java web application to syslog server:
1. When logging the stack trace in case of exceptions, all the stack strace should be seen as a single message.
Logback does not support this feature. Please create a jira issue asking for it.
2. Need to send either or all of the following information in logs- name of the web application, URL, version of the application.
Via MDC =======
Add the following code when your web-app starts:
MDC.put("appName", ...); MDC.put("appURL", ...); MDC.put("appVersion", ...);
In logback.xml:
<appender name="SYSLOG" class="ch.qos.logback.classic.net.SyslogAppender"> <SuffixPattern>%mdc{appName} %mdc{appURL} %mdc{appVersion} %logger %msg</SuffixPattern> </appender>
By system properties ====================
Set the following system properties:
-DappName=... -DappURL=... -DappVersion
In logback.xml:
<appender name="SYSLOG" class="ch.qos.logback.classic.net.SyslogAppender"> <SuffixPattern>%property{appName} %property{appURL} %property{appVersion} %logger %msg</SuffixPattern> </appender>
HTH
As per my knowledge, Syslog appender of Logback doesnot fit to above requirements. I am also looking for any other logging APIs which can satisfy these requirements. Any ideas? Thanks in advance.
- Pradnya
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user

One more question, with your specified way, appURL etc can be sent in the message. I am looking if this information can be sent in any of the syslog standard parameters other than message. The purpose is that it will be easier for the person analyzing the logs to just sort/filter on the separate parameters rather than looking to parse the actual log messages. I have very limited knowledge about the SYSLOG format. Any inputs on this? Thanks, Pradnya On Fri, Oct 22, 2010 at 11:17 AM, Ceki Gulcu <ceki@qos.ch> wrote:
On 22.10.2010 17:02, Pradnya Gawade wrote:
Hi,
I have following requirements when sending the log from a java web application to syslog server:
1. When logging the stack trace in case of exceptions, all the stack strace should be seen as a single message.
Logback does not support this feature. Please create a jira issue asking for it.
2. Need to send either or all of the following information in logs- name of the web application, URL, version of the application.
Via MDC =======
Add the following code when your web-app starts:
MDC.put("appName", ...); MDC.put("appURL", ...); MDC.put("appVersion", ...);
In logback.xml:
<appender name="SYSLOG" class="ch.qos.logback.classic.net.SyslogAppender"> <SuffixPattern>%mdc{appName} %mdc{appURL} %mdc{appVersion} %logger %msg</SuffixPattern> </appender>
By system properties ====================
Set the following system properties:
-DappName=... -DappURL=... -DappVersion
In logback.xml:
<appender name="SYSLOG" class="ch.qos.logback.classic.net.SyslogAppender"> <SuffixPattern>%property{appName} %property{appURL} %property{appVersion} %logger %msg</SuffixPattern> </appender>
HTH
As per my knowledge, Syslog appender of Logback doesnot fit to above requirements. I am also looking for any other logging APIs which can satisfy these requirements. Any ideas? Thanks in advance.
- Pradnya
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user

On Fri, Oct 22, 2010 at 5:17 PM, Ceki Gulcu <ceki@qos.ch> wrote:
On 22.10.2010 17:02, Pradnya Gawade wrote:
Hi,
I have following requirements when sending the log from a java web application to syslog server:
1. When logging the stack trace in case of exceptions, all the stack
strace should be seen as a single message.
Logback does not support this feature. Please create a jira issue asking for it.
Perhaps something like the indicated at "Useful Views<http://www.javaspecialists.eu/archive/Issue177.html>" may help you but using a http://logback.qos.ch/manual/layouts.html#customConversionSpecifier instead of a Log4J Layout. HTH
2. Need to send either or all of the following information in logs- name
of the web application, URL, version of the application.
Via MDC =======
Add the following code when your web-app starts:
MDC.put("appName", ...); MDC.put("appURL", ...); MDC.put("appVersion", ...);
In logback.xml:
<appender name="SYSLOG" class="ch.qos.logback.classic.net.SyslogAppender"> <SuffixPattern>%mdc{appName} %mdc{appURL} %mdc{appVersion} %logger %msg</SuffixPattern> </appender>
By system properties ====================
Set the following system properties:
-DappName=... -DappURL=... -DappVersion
In logback.xml:
<appender name="SYSLOG" class="ch.qos.logback.classic.net.SyslogAppender"> <SuffixPattern>%property{appName} %property{appURL} %property{appVersion} %logger %msg</SuffixPattern> </appender>
HTH
As per my knowledge, Syslog appender of Logback doesnot fit to above
requirements. I am also looking for any other logging APIs which can satisfy these requirements. Any ideas? Thanks in advance.
- Pradnya
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user

Thanks. That might be useful. I am in a process of programatically handling the stack trace to log it as a single message. But not sure syslog protocol/server has problem with line separator character which makes it display like this: *com.abc.main.init.InitializeMainAppJob.execute(InitializeMainAppJob.java:405)#015#012#011at org.quartz.core.JobRunShell.run(JobRunShell.java:202)#015#012#011at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525)#015#012 com.abc.main.init.InitializeMainAppJ* any ideas? Thanks, Pradnya 2010/10/25 César Álvarez Núñez <cesar.alvarez.nunez@gmail.com>
On Fri, Oct 22, 2010 at 5:17 PM, Ceki Gulcu <ceki@qos.ch> wrote:
On 22.10.2010 17:02, Pradnya Gawade wrote:
Hi,
I have following requirements when sending the log from a java web application to syslog server:
1. When logging the stack trace in case of exceptions, all the stack
strace should be seen as a single message.
Logback does not support this feature. Please create a jira issue asking for it.
Perhaps something like the indicated at "Useful Views<http://www.javaspecialists.eu/archive/Issue177.html>" may help you but using a http://logback.qos.ch/manual/layouts.html#customConversionSpecifierinstead of a Log4J Layout. HTH
2. Need to send either or all of the following information in logs- name
of the web application, URL, version of the application.
Via MDC =======
Add the following code when your web-app starts:
MDC.put("appName", ...); MDC.put("appURL", ...); MDC.put("appVersion", ...);
In logback.xml:
<appender name="SYSLOG" class="ch.qos.logback.classic.net.SyslogAppender"> <SuffixPattern>%mdc{appName} %mdc{appURL} %mdc{appVersion} %logger %msg</SuffixPattern> </appender>
By system properties ====================
Set the following system properties:
-DappName=... -DappURL=... -DappVersion
In logback.xml:
<appender name="SYSLOG" class="ch.qos.logback.classic.net.SyslogAppender"> <SuffixPattern>%property{appName} %property{appURL} %property{appVersion} %logger %msg</SuffixPattern> </appender>
HTH
As per my knowledge, Syslog appender of Logback doesnot fit to above
requirements. I am also looking for any other logging APIs which can satisfy these requirements. Any ideas? Thanks in advance.
- Pradnya
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user

Hi, I am trying to see if it is possible to send the web application name in the TAG part of Syslog message? I believe even if it is possible, I might to have to change some default code (override) of logback related to how it forms the message. But I am not sure if it is possible to change the default value that goes into the TAG field of syslog message. Any inputs? Thanks, Pradnya On Mon, Oct 25, 2010 at 4:55 PM, Pradnya Gawade <pradnya.gawade7@gmail.com>wrote:
Thanks. That might be useful. I am in a process of programatically handling the stack trace to log it as a single message. But not sure syslog protocol/server has problem with line separator character which makes it display like this:
*com.abc.main.init.InitializeMainAppJob.execute(InitializeMainAppJob.java:405)#015#012#011at org.quartz.core.JobRunShell.run(JobRunShell.java:202)#015#012#011at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525)#015#012 com.abc.main.init.InitializeMainAppJ*
any ideas?
Thanks, Pradnya
2010/10/25 César Álvarez Núñez <cesar.alvarez.nunez@gmail.com>
On Fri, Oct 22, 2010 at 5:17 PM, Ceki Gulcu <ceki@qos.ch> wrote:
On 22.10.2010 17:02, Pradnya Gawade wrote:
Hi,
I have following requirements when sending the log from a java web application to syslog server:
1. When logging the stack trace in case of exceptions, all the stack
strace should be seen as a single message.
Logback does not support this feature. Please create a jira issue asking for it.
Perhaps something like the indicated at "Useful Views<http://www.javaspecialists.eu/archive/Issue177.html>" may help you but using a http://logback.qos.ch/manual/layouts.html#customConversionSpecifierinstead of a Log4J Layout. HTH
2. Need to send either or all of the following information in logs- name
of the web application, URL, version of the application.
Via MDC =======
Add the following code when your web-app starts:
MDC.put("appName", ...); MDC.put("appURL", ...); MDC.put("appVersion", ...);
In logback.xml:
<appender name="SYSLOG" class="ch.qos.logback.classic.net.SyslogAppender"> <SuffixPattern>%mdc{appName} %mdc{appURL} %mdc{appVersion} %logger %msg</SuffixPattern> </appender>
By system properties ====================
Set the following system properties:
-DappName=... -DappURL=... -DappVersion
In logback.xml:
<appender name="SYSLOG" class="ch.qos.logback.classic.net.SyslogAppender"> <SuffixPattern>%property{appName} %property{appURL} %property{appVersion} %logger %msg</SuffixPattern> </appender>
HTH
As per my knowledge, Syslog appender of Logback doesnot fit to above
requirements. I am also looking for any other logging APIs which can satisfy these requirements. Any ideas? Thanks in advance.
- Pradnya
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user

Hey, I think I could figure it out. Using the square brackets in the value of pattern does the job. I am configuring the Syslog appender as: <appender name="SYSLOG" class="ch.qos.logback.classic.net.SyslogAppender"> <SyslogHost>192.168.15.184</SyslogHost> <Facility>LOCAL1</Facility> <SuffixPattern>[webAppName] %msg %logger </SuffixPattern> </appender> Thanks, Pradnya On Wed, Nov 17, 2010 at 4:52 PM, Pradnya Gawade <pradnya.gawade7@gmail.com>wrote:
Hi,
I am trying to see if it is possible to send the web application name in the TAG part of Syslog message? I believe even if it is possible, I might to have to change some default code (override) of logback related to how it forms the message. But I am not sure if it is possible to change the default value that goes into the TAG field of syslog message. Any inputs?
Thanks, Pradnya
On Mon, Oct 25, 2010 at 4:55 PM, Pradnya Gawade <pradnya.gawade7@gmail.com
wrote:
Thanks. That might be useful. I am in a process of programatically handling the stack trace to log it as a single message. But not sure syslog protocol/server has problem with line separator character which makes it display like this:
*com.abc.main.init.InitializeMainAppJob.execute(InitializeMainAppJob.java:405)#015#012#011at org.quartz.core.JobRunShell.run(JobRunShell.java:202)#015#012#011at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525)#015#012 com.abc.main.init.InitializeMainAppJ*
any ideas?
Thanks, Pradnya
2010/10/25 César Álvarez Núñez <cesar.alvarez.nunez@gmail.com>
On Fri, Oct 22, 2010 at 5:17 PM, Ceki Gulcu <ceki@qos.ch> wrote:
On 22.10.2010 17:02, Pradnya Gawade wrote:
Hi,
I have following requirements when sending the log from a java web application to syslog server:
1. When logging the stack trace in case of exceptions, all the stack
strace should be seen as a single message.
Logback does not support this feature. Please create a jira issue asking for it.
Perhaps something like the indicated at "Useful Views<http://www.javaspecialists.eu/archive/Issue177.html>" may help you but using a http://logback.qos.ch/manual/layouts.html#customConversionSpecifierinstead of a Log4J Layout. HTH
2. Need to send either or all of the following information in logs-
name of the web application, URL, version of the application.
Via MDC =======
Add the following code when your web-app starts:
MDC.put("appName", ...); MDC.put("appURL", ...); MDC.put("appVersion", ...);
In logback.xml:
<appender name="SYSLOG" class="ch.qos.logback.classic.net.SyslogAppender"> <SuffixPattern>%mdc{appName} %mdc{appURL} %mdc{appVersion} %logger %msg</SuffixPattern> </appender>
By system properties ====================
Set the following system properties:
-DappName=... -DappURL=... -DappVersion
In logback.xml:
<appender name="SYSLOG" class="ch.qos.logback.classic.net.SyslogAppender"> <SuffixPattern>%property{appName} %property{appURL} %property{appVersion} %logger %msg</SuffixPattern> </appender>
HTH
As per my knowledge, Syslog appender of Logback doesnot fit to above
requirements. I am also looking for any other logging APIs which can satisfy these requirements. Any ideas? Thanks in advance.
- Pradnya
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user
participants (3)
-
Ceki Gulcu
-
César Álvarez Núñez
-
Pradnya Gawade