This is really what I don't understand about JDK-logging - that
configuration is so complicated. Is it really like this or are there
simpler options?
regards,
Martin
On 8/13/07, Simon Lessard <[EMAIL PROTECTED]> wrote:
> Ok found the old project. This is not the cleanest way to configure it, but
> it works.
>
> First you need a .properties file to configure the logging system. Content
> must look like:
> handlers = java.util.logging.ConsoleHandler
>
> .level = FINEST
>
> java.util.logging.ConsoleHandler.level = FINEST
> java.util.logging.ConsoleHandler.formatter =
> java.util.logging.SimpleFormatter
>
>
> Then you must have the LogManager read that file. This is where it get
> tricky. You can either specified a startup JVM argument named -
> Djava.util.logging.config.file=myfile or you can do it
> programatically. Since I dislike dealign with startup options because you
> have to do it on every work stations, I rather use a ServletContextListener
> with the following contextInitialized method:
>
> public void contextInitialized(ServletContextEvent
> servletContextEvent)
> {
> try
> {
> InputStream istream =
> getClass().getResourceAsStream("/jdklogging.properties");
> try
> {
> LogManager.getLogManager().readConfiguration(istream);
> }
> finally
> {
> istream.close();
> }
> }
> catch (IOException e)
> {
> e.printStackTrace();
> }
> }
>
> Regards,
>
> ~ Simon
>
>
> On 8/13/07, Simon Lessard <[EMAIL PROTECTED]> wrote:
> > Yep, I lied... Ok let me dig up the pure and obscure JDK way.
> >
> >
> >
> > On 8/13/07, Perkins, Nate-P63196 <[EMAIL PROTECTED] > wrote:
> > >
> > >
> > > thanks, I do have the RI logs working in log4j using a similar logger.
> > >
> > >
> > > Nate Perkins
> > > 480-441-3667
> > > [EMAIL PROTECTED]
> > >
> > > This email message is for the sole use of the intended recipient(s) and
> may contain GDC4S
> > > confidential or privileged information. Any unauthorized review, use,
> disclosure or distribution
> > > is prohibited. If you are not an intended recipient, please contact the
> sender by reply email and
> > > destroy all copies of the original message.
> > >
> > >
> > > ________________________________
> From: Simon Lessard [mailto:[EMAIL PROTECTED]
> > > Sent: Monday, August 13, 2007 8:51 AM
> > >
> > > To: MyFaces Discussion
> > > Subject: Re: [Trinidad] Logging
> > >
> > >
> > >
> > > Actually I might have lied and mixed up JSF RI logs with Trinidad
> logs... Let me check the applications again. At worst I'll be able to give
> your more information for the pure JDK option.
> > >
> > >
> > > On 8/13/07, Perkins, Nate-P63196 <[EMAIL PROTECTED]> wrote:
> > > >
> > > >
> > > > the commons-logging.jar is in my application as well, are you saying i
> need to reference it in my configuration in a different way?
> > > >
> > > >
> > > > Nate Perkins
> > > > 480-441-3667
> > > > [EMAIL PROTECTED]
> > > >
> > > > This email message is for the sole use of the intended recipient(s)
> and may contain GDC4S
> > > > confidential or privileged information. Any unauthorized review, use,
> disclosure or distribution
> > > > is prohibited. If you are not an intended recipient, please contact
> the sender by reply email and
> > > > destroy all copies of the original message.
> > > >
> > > >
> > > > ________________________________
> From: Simon Lessard [mailto:[EMAIL PROTECTED]
> > > > Sent: Monday, August 13, 2007 8:45 AM
> > > >
> > > > To: MyFaces Discussion
> > > > Subject: Re: [Trinidad] Logging
> > > >
> > > >
> > > >
> > > > You must use commons-logging as well.
> > > >
> > > >
> > > > On 8/13/07, Perkins, Nate-P63196 <[EMAIL PROTECTED]> wrote:
> > > > >
> > > > >
> > > > > I am using log4j in my application and had attempted to add a logger
> for trinidad but had not been successful, I had added the following to my
> log4j.xml
> > > > >
> > > > > <logger name="org.apache.myfaces" additivity='false'>
> > > > > <level value="DEBUG"/>
> > > > > <appender-ref ref="view"/>
> > > > > </logger>
> > > > >
> > > > > is there something i am missing?
> > > > >
> > > > >
> > > > > Nate Perkins
> > > > > 480-441-3667
> > > > > [EMAIL PROTECTED]
> > > > >
> > > > > This email message is for the sole use of the intended recipient(s)
> and may contain GDC4S
> > > > > confidential or privileged information. Any unauthorized review,
> use, disclosure or distribution
> > > > > is prohibited. If you are not an intended recipient, please contact
> the sender by reply email and
> > > > > destroy all copies of the original message.
> > > > >
> > > > >
> > > > > ________________________________
> From: Simon Lessard [mailto:[EMAIL PROTECTED]
> > > > > Sent: Monday, August 13, 2007 8:40 AM
> > > > >
> > > > > To: MyFaces Discussion
> > > > > Subject: Re: [Trinidad] Logging
> > > > >
> > > > >
> > > > >
> > > > > Hello Nate,
> > > > >
> > > > > Trinidad uses JDK logging and can therefore be activated/configured
> accordingly. Another way is to add commons logging and log4j to your
> application. Commons logging override JDK logger with log4j thus enabling
> all the easy to learn formatting and output options of log4j. I slightly
> prefer the latter as I find JDK logging system quite complicated to
> configure, but I did use the former in one project.
> > > > >
> > > > > References for JDK logging should you use the pure JDK option:
> http://java.sun.com/j2se/1.4.2/docs/guide/util/logging/ ,
> http://javaboutique.internet.com/tutorials/logging_API/.
> > > > >
> > > > >
> > > > > Regards,
> > > > >
> > > > > ~ Simon
> > > > >
> > > > >
> > > > > On 8/13/07, Perkins, Nate-P63196 < [EMAIL PROTECTED]> wrote:
> > > > > > How can I turn on Trinidad logging? I have searched for this but
> have
> > > > > > not found the way.
> > > > > >
> > > > > >
> > > > > > Nate Perkins
> > > > > > 480-441-3667
> > > > > > [EMAIL PROTECTED]
> > > > > >
> > > > > > >This email message is for the sole use of the intended
> recipient(s) and
> > > > > > may contain GDC4S
> > > > > > > confidential or privileged information. Any unauthorized review,
> use,
> > > > > > disclosure or distribution
> > > > > > > is prohibited. If you are not an intended recipient, please
> contact
> > > > > > the sender by reply email and
> > > > > > > destroy all copies of the original message.
> > > > > > >
> > > > > >
> > > > > > -----Original Message-----
> > > > > > From: simon [mailto:[EMAIL PROTECTED]
> > > > > > Sent: Friday, August 10, 2007 8:49 AM
> > > > > > To: MyFaces Discussion
> > > > > > Subject: Re: [Trinidad] Logging
> > > > > >
> > > > > > On Fri, 2007-08-10 at 09:47 -0400, Murtaza Goga wrote:
> > > > > > > Are there any plans to migrate the logging in Trinidad to use
> Log4j?
> > > > > > > Is there a mechanism we could use Log4j.
> > > > > >
> > > > > > Java.util.logging is an API that code can implement. There also
> happens
> > > > > > to be a (pretty stupid) implementation of the API provided.
> > > > > >
> > > > > > Apache Tomcat 5.5 and later has an alternate implementation called
> JULI,
> > > > > > though it isn't available as a separate library.
> > > > > >
> > > > > > And this is available as a standalone lib:
> > > > > > http://www.x4juli.org/
> > > > > >
> > > > > > Hopefully the default java.util.logging implementation will
> improve
> > > > > > anyway...maybe even by merging x4juli now java is open-source?
> > > > > >
> > > > > > Regards,
> > > > > >
> > > > > > Simon
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
--
http://www.irian.at
Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German
Professional Support for Apache MyFaces