Hi Evgeny,
I think you may be asking the wrong question, or I'm misunderstanding what
you're asking for. I use a very vanilla log4j configuration, and there is
good documentation all over the web. First, the official log4j documentation
is well above-average:
http://logging.apache.org/log4j/1.2/manual.html
And also, for example:
http://www.devdaily.com/blog/post/java/simple-log4j-example/
http://www.mobilefish.com/developer/log4j/log4j_quickguide_examples.html
Please let me know if you had a more specific question, and my apologies if
I misunderstood your question...
Best wishes,
Aaron
"Evgeny Shepelyuk" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Hello Aaron.
Thnx for examples
One small note. I will be very appreciated if u also post ur log4j config.
For access logs only :)
24.07.08 в 19:36 Aaron Crow в своём письме писал(а):
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
--
Best Regards
Evgeny K. Shepelyuk