Hi Aron,

Note that it is totally possible to make JUL display log lines on just one 
line. It's a matter of providing a custom formatter (very easy).

For NRE, we provide our own, see:
http://www.restlet.org/documentation/snapshot/nre/com/noelios/restlet/util/AccessLogFormatter.html

We also have a more detailed page on logging in our wiki, with tips for JUL 
configuration:
http://wiki.restlet.org/docs_1.1/g1/13-restlet/29-restlet/98-restlet/101-restlet.html

Best regards,
Jerome

-----Message d'origine-----
De : news [mailto:[EMAIL PROTECTED] De la part de Aaron Crow
Envoyé : jeudi 24 juillet 2008 18:37
À : discuss@restlet.tigris.org
Objet : Re: Support for log4j?

Hi Evgeny,

Sure, I will. First though, I'd like to say that I don't consider it the 
ideal solution. In my case I just want the Restlet's access logs, and if I 
can emulate those myself with my own logging statements, I'll be happier. 
That being said, here's what I did to redirect Restlet's JDK logging to 
slf4j and then log4j:

1) Read http://www.slf4j.org/legacy.html

2) Added the following to my pom (**verbosity warning!**):

    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.4.3</version>
        <exclusions>
          <!-- needed to avoid endless recursion, per:
               http://www.slf4j.org/legacy.html
          -->
          <exclusion>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-jdk14</artifactId>
          </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>1.5.2</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>jul-to-slf4j</artifactId>
        <version>1.5.2</version>
    </dependency>
    <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
      <version>1.2.12</version>
    </dependency>

3) Added the following to my app's main method:
  // needs: import org.slf4j.bridge.SLF4JBridgeHandler;
  SLF4JBridgeHandler.install();

I then did what you normally do to configure log4j, and saw restlet's 
logging go to the targets I configured in my log4j.properties file. I do see 
the formatting is a little awkward, but at least it's down to one line. (I 
never made my peace w/jul's forced multi-line logging ;-)


Hope this helps!
Aaron




----- Original Message ----- 
From: "Evgeny Shepelyuk" <[EMAIL PROTECTED]>
Newsgroups: gmane.comp.java.restlet
To: <discuss@restlet.tigris.org>
Sent: Thursday, July 24, 2008 12:19 AM
Subject: Re: Support for log4j?


> Hello Aaron !
> Would u be so kind to share how u set up slf4j to be used as a bridge from 
> restlet to log4j ?
>
> -- 
> Best Regards
> Evgeny K. Shepelyuk
>
>
"Evgeny Shepelyuk" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hello Aaron !
> Would u be so kind to share how u set up slf4j to be used as a bridge from 
> restlet to log4j ?
>
> -- 
> Best Regards
> Evgeny K. Shepelyuk
>
> 


Reply via email to