You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Filippo Balicchia <fb...@gmail.com> on 2011/07/07 13:38:37 UTC
my own appender
Hello,
I try to create my own appender but when i start my servicemix 4.3.0
it seems that dosen't write log file.
This is what i done :
I have define my log4j.properties
log4j.rootLogger=INFO, FILE
log4j.appender.FILE=org.apache.log4j.FileAppender
log4j.appender.FILE.File=mylFilelog.log
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.FILE.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n%M
then i have create a jar using this manifest
Manifest-Version: 1.0
Fragment-Host: org.ops4j.pax.logging.pax-logging-service
Bundle-Version: 1.0.0
Bundle-Name: Log4J Configuration
Created-By: 1.6.0_24 (Sun Microsystems Inc.)
Bundle-ManifestVersion: 2
Bundle-SymbolicName: it.myfragment.log
my service is active
[ 3] [Active ] [ ] [ ] [ 8] OPS4J Pax Logging - API (1
.5.3)
[ 4] [Active ] [ ] [ ] [ 8] OPS4J Pax Logging - Servic
then i have install it as bundle and i have restart servicemix
but .... i don't see my log file ?
Where am i wrong ?
Thanks for help
cheers
--Filippo
Re: my own appender
Posted by Freeman Fang <fr...@gmail.com>.
Hi,
Take a look at [1], the "Using your own appender" chapter, to get details how to use your own appender(The fragment bundle way).
Or you can use OSGI service way to register your own appender, take a look at Charles's recent commit here[2]
[1]http://karaf.apache.org/manual/latest-2.2.x/users-guide/logging-system.html
[2]https://issues.apache.org/jira/browse/SMX4-1205
Freeman
-------------
Freeman Fang
FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: http://weibo.com/u/1473905042
On 2012-8-9, at 下午9:03, rsmaoui wrote:
> Hi Freeman,
>
> I try also to create my own appender, so i added my configuration into
> $SMX$_HOME/etc/org.ops4j.pax.logging.cfg file
>
>
> # Root logger
> log4j.rootLogger=INFO, out, osgi:VmLogAppender, SYSLOG
>
> # SysLog appender
> log4j.appender.SYSLOG=org.apache.log4j.net.SyslogAppender
> log4j.appender.SYSLOG.SyslogHost=localhost
> log4j.appender.SYSLOG.threshold=info
> log4j.appender.SYSLOG.Facility=LOCAL1
> log4j.appender.SYSLOG.layout=org.apache.log4j.PatternLayout
> log4j.appender.SYSLOG.layout.ConversionPattern=%d{ABSOLUTE} - [%-5p]
> %c %x %m%n
>
> With this configuration, logs should be redirected to the file
> /var/log/messages but in my case there is not changed!!!
> there is another configuration must be added to create my own appender
>
>
>
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/my-own-appender-tp4560759p5714113.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
Re: my own appender
Posted by rsmaoui <s-...@hotmail.com>.
Hi Freeman,
I try also to create my own appender, so i added my configuration into
$SMX$_HOME/etc/org.ops4j.pax.logging.cfg file
# Root logger
log4j.rootLogger=INFO, out, osgi:VmLogAppender, SYSLOG
# SysLog appender
log4j.appender.SYSLOG=org.apache.log4j.net.SyslogAppender
log4j.appender.SYSLOG.SyslogHost=localhost
log4j.appender.SYSLOG.threshold=info
log4j.appender.SYSLOG.Facility=LOCAL1
log4j.appender.SYSLOG.layout=org.apache.log4j.PatternLayout
log4j.appender.SYSLOG.layout.ConversionPattern=%d{ABSOLUTE} - [%-5p]
%c %x %m%n
With this configuration, logs should be redirected to the file
/var/log/messages but in my case there is not changed!!!
there is another configuration must be added to create my own appender
--
View this message in context: http://servicemix.396122.n5.nabble.com/my-own-appender-tp4560759p5714113.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.
Re: my own appender
Posted by Freeman Fang <fr...@gmail.com>.
Hi,
My comment inline
On 2011-7-7, at 下午7:38, Filippo Balicchia wrote:
> Hello,
> I try to create my own appender but when i start my servicemix 4.3.0
> it seems that dosen't write log file.
>
> This is what i done :
>
> I have define my log4j.properties
>
> log4j.rootLogger=INFO, FILE
> log4j.appender.FILE=org.apache.log4j.FileAppender
> log4j.appender.FILE.File=mylFilelog.log
> log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
> log4j.appender.FILE.layout.ConversionPattern=%-4r [%t] %-5p %c %x -
> %m%n%M
You just need edit $SMX$_HOME/etc/org.ops4j.pax.logging.cfg, add your
configuration there.
>
> then i have create a jar using this manifest
>
> Manifest-Version: 1.0
> Fragment-Host: org.ops4j.pax.logging.pax-logging-service
> Bundle-Version: 1.0.0
> Bundle-Name: Log4J Configuration
> Created-By: 1.6.0_24 (Sun Microsystems Inc.)
> Bundle-ManifestVersion: 2
> Bundle-SymbolicName: it.myfragment.log
I don't think you need create fragment bundle in this case, as you
don't really create a new customer appender, you just configure it.
Freeman
>
> my service is active
>
> [ 3] [Active ] [ ] [ ] [ 8] OPS4J Pax
> Logging - API (1
> .5.3)
> [ 4] [Active ] [ ] [ ] [ 8] OPS4J Pax
> Logging - Servic
>
>
> then i have install it as bundle and i have restart servicemix
> but .... i don't see my log file ?
>
> Where am i wrong ?
>
> Thanks for help
>
>
> cheers
> --Filippo
---------------------------------------------
Freeman Fang
FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com