Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-dev] Logging implementations

Hi Greg,

I'm sure you are right, as I read the same on a lot of places over the internet. I have added the log4j-slf4 bridge

        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-slf4j-impl</artifactId>
            <version>${log4j.version}</version>
        </dependency>

in my project but all I can see is slf4j loggings being logged using the slf4j simple logger:

2014-01-13 09:07:07,750 [main] INFO : Mapped "{[/signin/{providerId}],methods=[GET],params=[error],headers=[],consumes=[
],produces=[],custom=[]}" onto public org.springframework.web.servlet.view.RedirectView org.springframework.social.conne
ct.web.ProviderSignInController.oauth2ErrorCallback(java.lang.String,java.lang.String,java.lang.String,java.lang.String,
org.springframework.web.context.request.NativeWebRequest)
[INFO] ResourceChangeScanner reconfigured with interval=60
[INFO] ResourceChangeScanner created with default interval=60
2014-01-13 09:07:08,563 [main] INFO : Root WebApplicationContext: initialization completed in 28985 ms
2014-01-13 09:07:08.564:INFO:/:Log4jServletContextListener ensuring that Log4j starts up properly.
2014-01-13 09:07:08.590:INFO:/:Log4jServletFilter initialized.

just as the jetty logs say:

---------
[DEBUG] Logging to org.slf4j.impl.SimpleLogger(org.eclipse.jetty.util.log) via org.eclipse.jetty.util.log.Slf4jLog
---------

I believe that someone (jetty, maven, plexus, jetty-maven-plugin) is dragging the slf4j's simple logger in the classpath,
which overrides the log4j2's simplelogger. Unfortunately I can't find out which one.

I will try to create a jetty logger that goes directly to log4j2, cause honestly I don't know what else to do.




2014/1/13 Greg Wilkins <gregw@xxxxxxxxxxx>

Petar,

we don't code against the SimpleLogger API.  Jetty uses it's own Logger API and it will log to stderr if there is no log jars available.    If you only provide the slf4j->log4j2 jar, then jetty logging will detect that as an slf4j log and will use that instead.

If you want to avoid slf4j entirely, you could also write an instance of the Jetty logger that goes direct to log4j2.

cheers




On 12 January 2014 23:55, Petar Tahchiev <paranoiabla@xxxxxxxxx> wrote:
Hi guys,

I'm using the jetty-maven-plugin version 8.1.14.v20131031 and during startup I get this:

---------
[DEBUG] Logging to org.slf4j.impl.SimpleLogger(org.eclipse.jetty.util.log) via org.eclipse.jetty.util.log.Slf4jLog
---------

My application however uses Log4j2 as a logging implementation of slfj4. So instead of having:

log4j -routed to-> log4j2
jcl    -routed to -> log4j2
slf4j -routed to -> log4j2
jul    -routed to -> slf4j -routed to -> log4j2

i correctly get the output of log4j,jcl and log4j2,
but the jul and the slf4j do not get routed to log4j2!!!
As a result I have to configure now both - log4j and slf4j!!!

I don't think it's correct of you to log everything to SimpleLogger - this way you force the user to use the slf4j as their logging implementation. I think you should code against the slf4j-api and then ask the user to select whatever implementation they like.

Any suggestions on how to overcome this are welcome.

--
Regards, Petar!
Karlovo, Bulgaria.
---
Public PGP Key at: https://keyserver1.pgp.com/vkd/DownloadKey.event?keyid=0x19658550C3110611
Key Fingerprint: A369 A7EE 61BC 93A3 CDFF  55A5 1965 8550 C311 0611

_______________________________________________
jetty-dev mailing list
jetty-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-dev



_______________________________________________
jetty-dev mailing list
jetty-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-dev




--
Regards, Petar!
Karlovo, Bulgaria.
---
Public PGP Key at: https://keyserver1.pgp.com/vkd/DownloadKey.event?keyid=0x19658550C3110611
Key Fingerprint: A369 A7EE 61BC 93A3 CDFF  55A5 1965 8550 C311 0611

Back to the top