|
Re: Logging in Virgo 3.0.0.M05 [message #682198 is a reply to message #682190] |
Fri, 10 June 2011 15:34 |
|
Hi,
I'll have a look at this as I did the LogService work, thanks for providing a test bundle.
Chris.
------------------------------------------------
Chris Frost, Twitter @cgfrost
Springsource, a divison of VMware.
|
|
|
Re: Logging in Virgo 3.0.0.M05 [message #683791 is a reply to message #682198] |
Tue, 14 June 2011 12:39 |
|
Hi,
So on the first point, this is working as designed. All logging will go in the main log file unless you configure it otherwise. The logback file you are using is sending it else where. It's recommended however that you don't add logback config to your own bundles and instead just configure the main logback.xml in the config directory.
As for the OSGi logging service, it looks like there are two available and one of them doesn't do anything and you are binding to that one. I have put a fix in the code and it will be in the next shipping.
Hope that help, please come back if you still have questions.
Chris.
------------------------------------------------
Chris Frost, Twitter @cgfrost
Springsource, a divison of VMware.
|
|
|
Re: Logging in Virgo 3.0.0.M05 [message #683891 is a reply to message #683791] |
Tue, 14 June 2011 15:48 |
Raji Abraham Messages: 13 Registered: October 2010 |
Junior Member |
|
|
Chris,
Appreciate your time in looking at this. Yes, I do not want to add logback config in each bundle. If its working as designed, then I believe it is not working as documented. Let me quote the docs again:
Quote:By default, the VWS trace file is called $SERVER_HOME/serviceability/logs/log.log, and, again by default, the application trace files are called $SERVER_HOME/serviceability/logs/application_name/log.log, where application_name is automatically set by VWS for each application artifact installed and run (it is a combination of the artifact name and the version).
The config/serviceablity.xml file has the following entry "out of the box":
<appender name="SIFTED_LOG_FILE" class="ch.qos.logback.classic.sift.SiftingAppender">
<discriminator>
<Key>applicationName</Key>
<DefaultValue>virgo-server</DefaultValue>
</discriminator>
<sift>
<appender name="${applicationName}_LOG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>serviceability/logs/${applicationName}/log.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<FileNamePattern>serviceability/logs/${applicationName}/log_%i.log</FileNamePattern>
<MinIndex>1</MinIndex>
<MaxIndex>4</MaxIndex>
</rollingPolicy>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<MaxFileSize>10MB</MaxFileSize>
</triggeringPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<Pattern>[%d{yyyy-MM-dd HH:mm:ss.SSS}] %-5level %-28.28thread %-64.64logger{64} %X{medic.eventCode} %msg %ex%n</Pattern>
</encoder>
</appender>
</sift>
</appender>
Without changing anything in this file, I was able to achieve what I want by adding the following code to my bundle:
MDC.put("applicationName", "my.bundle.name");
Now the output from System.err, System.out and the specific logging code is directed to the serviceability/logs/my.bundle.name/log.log. I thought the document implied that VWS is setting the MDC (or something else) to make this happen automatically. Is that not true?
Thanks
Raji
|
|
|
Re: Logging in Virgo 3.0.0.M05 [message #685491 is a reply to message #683891] |
Fri, 17 June 2011 15:59 |
|
Hi,
So with the LogService fix in place I have the following happening with your application deployed.
SLF4J logging goes in the per-app log file and the sys and logservice logging goes in the main log file.
I have checked the intended behavior with my team mate and it should be as follows. By default per-app logging should only occur for web bundles, scoped plans and pars. Nothing else should get it's own logging file. In every case all logging should go in the main log file in addition to any per app log files that are being appended to.
There may be some improvements required to the way we split logging out to the per-app file. Certainly the SLF4J logging service is the best one to use. It's also interesting that your configuration produces a logging file with a name that doesn't have the version in it.
Could you create a bugzilla (https://bugs.eclipse.org/bugs/enter_bug.cgi under RT/Virgo) with your sample app and referencing this forum thread so that some propper time gets spent on this. We certainly want to get this straight before 3.0 goes out.
Chris.
------------------------------------------------
Chris Frost, Twitter @cgfrost
Springsource, a divison of VMware.
|
|
|
|
|
Re: Logging in Virgo 3.0.0.M05 [message #689877 is a reply to message #688498] |
Tue, 28 June 2011 14:31 |
|
I have made improvements to the documentation for this. I tried your test bundle and a couple variations of it on Virgo and it is all working as designed. Bug closed.
Making that call to MDC will indeed work but I'd recommend sticking to SLF4J for all your logging within your application or simply referencing you bundle from a scoped plan and let Virgo do the per app configuration behind the scenes.
------------------------------------------------
Chris Frost, Twitter @cgfrost
Springsource, a divison of VMware.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03047 seconds