You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Lane <la...@joeandlane.com> on 2005/05/23 19:01:20 UTC

confused about simple logging

Hello.

I'm a bit confused about simple logging on tomcat 5.0.  I've read much of the 
FAQ at http://jakarta.apache.org/tomcat/faq/logging.html#builtIn but that 
doesn't seem to address what I'm looking for, which is just routine mundane 
daily activity.

For instance, if I create and deploy a simple "Hello World" application that 
contains only index.jsp, no servlets, no external classes and no JNDI 
resources, where on earth will a "hit" be recorded when I navigate to 
http://localhost/helloworld/index.jsp ?  And where is the error recorded if I 
mistype and navigate to http://localhost/helloworld/jndex.JSP ?

Do I have to build such logging into the application?  Or does Catalina handle 
that for me?  And if so ... where on earth?

I'm using FreeBSD installed at /usr/local/jakarta-tomcat5.0

I see log information in /usr/local/jakarta-tomcat5.0/logs/stderr.log 
and /usr/local/jakarta-tomcat5.0/logs/stdout.log but nothing that records a 
"page hit."

Thanks,

lane

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: confused about simple logging

Posted by Hassan Schroeder <ha...@webtuitive.com>.
Lane wrote:

> I got the <valve> configured and working in server.xml and immediately set 
> about trying to make it work only in a specific context. 

> I've tried to configure it in 
> $CATALINA_HOME/conf/Catalina/localhost/helloworld.xml and in 
> $CATALINA_HOME/webapps/hellowworld/WEB-INF/web.xml but the <Valve> seems to 
> be ignored unless it is in $CATALINA_HOME/conf/server.xml
> 
> I'm set now, but if anybody has information on per-context access logging it'd 
> sure help me troubleshoot.

I just took the Valve entry from a Host in my server.xml, stuck it
inside a ROOT.xml file changing only the prefix attribute, restarted
the server and bingo -- a context-specific log file is being created.

There's really not much to it, as the example in the docs shows.

Maybe you should post your entire Context file.

-- 
Hassan Schroeder ----------------------------- hassan@webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                           dream.  code.



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: confused about simple logging

Posted by Lane <la...@joeandlane.com>.
On Monday 23 May 2005 12:28, Steve Kirk wrote:
> Your confusion possibly arises because there are at least 2 types of logger
> that you might mean, and 3 main choices for one of those at the moment,
> although one of those 3 is deprecated and a second is probably becoming
> less popular.
>
> OK I'll take a quick stab and see if this gets you anywhere in the right
> direction.
>
> You mention two distinct types of logging.  The 1st is the "hit" logging
> which is very similar to what you would get from apache httpd.  This simply
> logs each incoming request.  This is achieved by adding a <Valve> to your
> %catalina_home%\conf\server.xml - you can embed it inside the
> <Host></Host>, <Engine></Engine> or <Context></Context> tags, but for your
> purposes, just shove it in the engine for now.  It looks a bit like this:
>
> <Engine blah blah>
> 	<Valve
> className="org.apache.catalina.valves.FastCommonAccessLogValve"
> 		directory="logs"  prefix="ao_access_log_" suffix=".log"
> 		pattern="common" resolveHosts="false"/>
> </Engine>
>
> You can tweak the path, filename, and the pattern that defines each line -
> see
> http://jakarta.apache.org/tomcat/tomcat-5.0-doc/config/valve.html
> for details.  Leave resolveHosts set "false" to speed up performance.
>
> Not that my example above is from my own 5.5.9 server - ISTR 5.0 config
> syntax is different - check the doc link above for the detail.
>
> The 2nd part of your logging is where you write your own messages to a
> logfile.  I did that as follows:
>
> java.util.logging.Logger logger =
> java.util.logging.Logger.getLogger("logname");
> logger.setLevel(logLevel);
> fh = new FileHandler(logFilePath, maxLogFileSize, logFileCount, true);
> fh.setFormatter(new AoLogFormatter(logFileDateTimePattern));
> logger.addHandler(fh);
>
> Then to write a log message you can just do this:
>
> 	log("Write this to the log");
>
> and it will write the log file to logFilePath
>
> See the java.util.logging.Logger javadocs for more details.
>
> This is very basic.  Much more spophistication can be achieved through
> config files.
>
> > -----Original Message-----
> > From: Lane [mailto:lane@joeandlane.com]
> > Sent: Monday 23 May 2005 18:01
> > To: Tomcat Users List
> > Subject: confused about simple logging
> >
> >
> > Hello.
> >
> > I'm a bit confused about simple logging on tomcat 5.0.  I've
> > read much of the
> > FAQ at
> > http://jakarta.apache.org/tomcat/faq/logging.html#builtIn but that
> > doesn't seem to address what I'm looking for, which is just
> > routine mundane
> > daily activity.
> >
> > For instance, if I create and deploy a simple "Hello World"
> > application that
> > contains only index.jsp, no servlets, no external classes and no JNDI
> > resources, where on earth will a "hit" be recorded when I navigate to
> > http://localhost/helloworld/index.jsp ?  And where is the
> > error recorded if I
> > mistype and navigate to http://localhost/helloworld/jndex.JSP ?
> >
> > Do I have to build such logging into the application?  Or
> > does Catalina handle
> > that for me?  And if so ... where on earth?
> >
> > I'm using FreeBSD installed at /usr/local/jakarta-tomcat5.0
> >
> > I see log information in /usr/local/jakarta-tomcat5.0/logs/stderr.log
> > and /usr/local/jakarta-tomcat5.0/logs/stdout.log but nothing
> > that records a
> > "page hit."
> >
> > Thanks,
> >
> > lane
> >
Thanks, Steven.

I got the <valve> configured and working in server.xml and immediately set 
about trying to make it work only in a specific context.  I guess I just 
can't leave well enough alone :)

You are correct that for my purposes it is alright to log such requests 
"system" (engine || server) wide.

But the documentation at 

http://jakarta.apache.org/tomcat/tomcat-5.0-doc/config/context.html#Special+Features

seems to imply such an access log can be maintained per-context.  

I've tried to configure it in 
$CATALINA_HOME/conf/Catalina/localhost/helloworld.xml and in 
$CATALINA_HOME/webapps/hellowworld/WEB-INF/web.xml but the <Valve> seems to 
be ignored unless it is in $CATALINA_HOME/conf/server.xml

I'm set now, but if anybody has information on per-context access logging it'd 
sure help me troubleshoot.

lane

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: confused about simple logging

Posted by Rhino <rh...@sympatico.ca>.
----- Original Message ----- 
From: "Jim Henderson" <jg...@metafile.com>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Monday, May 23, 2005 2:01 PM
Subject: RE: confused about simple logging


> 
> If I write to stdout where does that go?
> 
> System.stdout.println("Where does this get printed to?");
> 
> I assume C:/tomcat.../log/stdout?
> 
Nope, catalina.out in c:\tomcat\logs if I recall correctly.

Rhino



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.322 / Virus Database: 266.11.15 - Release Date: 22/05/2005


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Can mulitple domains share one web app?

Posted by Parsons Technical Services <pa...@earthlink.net>.
Sorry for the delay. Been off-line. It would be in Tomcat.

http://jakarta.apache.org/tomcat/tomcat-5.0-doc/config/host.html#Host%20Name%20Aliases

Doug

----- Original Message ----- 
From: "Randy Paries" <ra...@unitnet.com>
To: "'Tomcat Users List'" <to...@jakarta.apache.org>; 
<pa...@earthlink.net>
Sent: Monday, May 23, 2005 3:42 PM
Subject: RE: Can mulitple domains share one web app?


> So would this be an alias within apache or tomcat?
>
> Thanks
>
> Randy
>
>
> ============================================================================
> ================
>
> From: "Parsons Technical Services" <pa...@earthlink.net>
> Subject: Re: Can mulitple domains share one web app?
> Date: Fri, 20 May 2005 21:14:26 GMT
> Prev Next Prev by Thread Next by Thread
>
> ----------------------------------------------------------------------------
> ----
>
> Alias might do what you want with one reservation, you cannot have
> www.mydomain.com/bob
> www.yourdomain.com/bob
> as different folders. These will be the same folder. So each /folder will
> have to be unique even though the domain names are different.
>
> Doug
>
>
> ----- Original Message -----
> From: "Randy Paries" <ra...@unitnet.com>
> To: "'Tomcat Users List'" <to...@jakarta.apache.org>
> Sent: Friday, May 20, 2005 4:55 PM
> Subject: Can mulitple domains share one web app?
>
>
>> Hello,
>>
>> I will try to ask this question so it makes sense.
>>
>> I have a webapp.
>>
>> Currently I have 2000 people that share the same web app
>>
>> For example
>>
>> www.mydomain.com/sue
>> www.mydomain.com/fred
>>
>> Etc....  All these guys have their own directories, but they are a single
>> web app.
>>
>> Now I have many (100s ) that want their own domains. I do not want to
>> create
>> 100 webapps
>>
>> Currently have a work around where
>> www.sue.com gets redirected via apache to www.mydomain.com/sue
>> So this way they start at their domain, but the immediately they see the
>> www.mydomain.com/sue
>>
>> So is there a way to have one webapp share multiple domains?
>>
>> Thanks
>> Randy
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>
> ----------------------------------------------------------------------------
> ----
> Message Index: [Date] [Author] [Thread]
> Prev Next Prev by Thread Next by Thread
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Can mulitple domains share one web app?

Posted by Randy Paries <ra...@unitnet.com>.
So would this be an alias within apache or tomcat?

Thanks

Randy
 

============================================================================
================

From: "Parsons Technical Services" <pa...@earthlink.net>
Subject: Re: Can mulitple domains share one web app?
Date: Fri, 20 May 2005 21:14:26 GMT
Prev Next Prev by Thread Next by Thread

----------------------------------------------------------------------------
----

Alias might do what you want with one reservation, you cannot have
www.mydomain.com/bob
www.yourdomain.com/bob
as different folders. These will be the same folder. So each /folder will
have to be unique even though the domain names are different.

Doug


----- Original Message -----
From: "Randy Paries" <ra...@unitnet.com>
To: "'Tomcat Users List'" <to...@jakarta.apache.org>
Sent: Friday, May 20, 2005 4:55 PM
Subject: Can mulitple domains share one web app?


> Hello,
>
> I will try to ask this question so it makes sense.
>
> I have a webapp.
>
> Currently I have 2000 people that share the same web app
>
> For example
>
> www.mydomain.com/sue
> www.mydomain.com/fred
>
> Etc....  All these guys have their own directories, but they are a single
> web app.
>
> Now I have many (100s ) that want their own domains. I do not want to
> create
> 100 webapps
>
> Currently have a work around where
> www.sue.com gets redirected via apache to www.mydomain.com/sue
> So this way they start at their domain, but the immediately they see the
> www.mydomain.com/sue
>
> So is there a way to have one webapp share multiple domains?
>
> Thanks
> Randy
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org



----------------------------------------------------------------------------
----
Message Index: [Date] [Author] [Thread]
Prev Next Prev by Thread Next by Thread 



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: confused about simple logging

Posted by Jim Henderson <jg...@metafile.com>.
GOOD IDEA!   I'll do that!   (When this is done, I should have no logging at
all.)

-----Original Message-----
From: Steve Kirk [mailto:tomcat-user@web-startup.co.uk]
Sent: Monday, May 23, 2005 2:23 PM
To: 'Tomcat Users List'
Subject: RE: confused about simple logging

If you really reach your wits end making logging work and just want a blunt
instrument to detect one-off if your overloaded method is called, when not
do something else to signal its presence, such as add a line to it which
creates a file called "ive.been.called" in a certain directory.  Gets you
past having to fix your log/stream problem.  You won't find this logging
framework in the TC docs though ;)



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: confused about simple logging

Posted by Steve Kirk <to...@web-startup.co.uk>.
Sorry can't help you there.  I was where you are now a year or more ago,
"fancy logging frameworks - too much hassle to learn for the simple logs
that I want".  But I soon realised that it was more work, and quite a bit
more ugly, trying to do your own thing.  I'd say bite the bullet and embrace
the latest release and logging framework.  There have been a few different
ones over recent versions, but the TC dev team are converging them nicely
now.  It might seem a little over engineered for simple logging requirements
at first, but once you spend the time to make it work, you will get what you
want, and come to realise that the advanced features are really useful for
debugging in situations exactly like yours.

I'm using commons-logging very successfully, is very flexible and not hard
to learn.

If you really reach your wits end making logging work and just want a blunt
instrument to detect one-off if your overloaded method is called, when not
do something else to signal its presence, such as add a line to it which
creates a file called "ive.been.called" in a certain directory.  Gets you
past having to fix your log/stream problem.  You won't find this logging
framework in the TC docs though ;)

> -----Original Message-----
> From: Jim Henderson [mailto:jgh@metafile.com] 
> Sent: Monday 23 May 2005 19:58
> To: Tomcat Users List
> Subject: RE: confused about simple logging
> 
> 
> Well I am having lots of self doubt.
> 
> I am trying to install my own overloaded JDBCRealm,  I have 
> been getting
> some Sybase jdescripter error.  (My backend DB has an old 
> means of encoding
> passwords so I overloaded the getPassword method.)  I don't 
> know if my code
> is getting called or is it not.  I have System.out.... trace 
> statements in
> the constructor after the call to the super ctor as well as 
> the getPassword
> method.   And, I see none of my trace in any of the Tomcat log files.
> 
> This is frustrating after 3 days.
> 
> -----Original Message-----
> From: Steve Kirk [mailto:tomcat-user@web-startup.co.uk]
> Sent: Monday, May 23, 2005 1:46 PM
> To: 'Tomcat Users List'
> Subject: RE: confused about simple logging
> 
> 
> 
> Not sure, ut I think all the output streams are diverted to 
> that file.  It's
> probably configurable.  Don't know full detail to be honest.  
> Best wasy is
> try it and see.
> 
> > -----Original Message-----
> > From: Jim Henderson [mailto:jgh@metafile.com]
> > Sent: Monday 23 May 2005 19:02
> > To: Tomcat Users List
> > Subject: RE: confused about simple logging
> >
> >
> >
> > If I write to stdout where does that go?
> >
> > System.stdout.println("Where does this get printed to?");
> >
> > I assume C:/tomcat.../log/stdout?
> >
> > -----Original Message-----
> > From: Steve Kirk [mailto:tomcat-user@web-startup.co.uk]
> > Sent: Monday, May 23, 2005 12:28 PM
> > To: 'Tomcat Users List'
> > Subject: RE: confused about simple logging
> >
> >
> >
> > Your confusion possibly arises because there are at least 2
> > types of logger
> > that you might mean, and 3 main choices for one of those at
> > the moment,
> > although one of those 3 is deprecated and a second is
> > probably becoming less
> > popular.
> >
> > OK I'll take a quick stab and see if this gets you anywhere
> > in the right
> > direction.
> >
> > You mention two distinct types of logging.  The 1st is the
> > "hit" logging
> > which is very similar to what you would get from apache
> > httpd.  This simply
> > logs each incoming request.  This is achieved by adding a
> > <Valve> to your
> > %catalina_home%\conf\server.xml - you can embed it inside the
> > <Host></Host>,
> > <Engine></Engine> or <Context></Context> tags, but for your
> > purposes, just
> > shove it in the engine for now.  It looks a bit like this:
> >
> > <Engine blah blah>
> > 	<Valve
> > className="org.apache.catalina.valves.FastCommonAccessLogValve"
> > 		directory="logs"  prefix="ao_access_log_" suffix=".log"
> > 		pattern="common" resolveHosts="false"/>
> > </Engine>
> >
> > You can tweak the path, filename, and the pattern that
> > defines each line -
> > see
> > http://jakarta.apache.org/tomcat/tomcat-5.0-doc/config/valve.html
> > for details.  Leave resolveHosts set "false" to speed up 
> performance.
> >
> > Not that my example above is from my own 5.5.9 server - ISTR
> > 5.0 config
> > syntax is different - check the doc link above for the detail.
> >
> > The 2nd part of your logging is where you write your own 
> messages to a
> > logfile.  I did that as follows:
> >
> > java.util.logging.Logger logger =
> > java.util.logging.Logger.getLogger("logname");
> > logger.setLevel(logLevel);
> > fh = new FileHandler(logFilePath, maxLogFileSize, 
> logFileCount, true);
> > fh.setFormatter(new AoLogFormatter(logFileDateTimePattern));
> > logger.addHandler(fh);
> >
> > Then to write a log message you can just do this:
> >
> > 	log("Write this to the log");
> >
> > and it will write the log file to logFilePath
> >
> > See the java.util.logging.Logger javadocs for more details.
> >
> > This is very basic.  Much more spophistication can be 
> achieved through
> > config files.
> >
> > > -----Original Message-----
> > > From: Lane [mailto:lane@joeandlane.com]
> > > Sent: Monday 23 May 2005 18:01
> > > To: Tomcat Users List
> > > Subject: confused about simple logging
> > >
> > >
> > > Hello.
> > >
> > > I'm a bit confused about simple logging on tomcat 5.0.  I've
> > > read much of the
> > > FAQ at
> > > http://jakarta.apache.org/tomcat/faq/logging.html#builtIn but that
> > > doesn't seem to address what I'm looking for, which is just
> > > routine mundane
> > > daily activity.
> > >
> > > For instance, if I create and deploy a simple "Hello World"
> > > application that
> > > contains only index.jsp, no servlets, no external classes
> > and no JNDI
> > > resources, where on earth will a "hit" be recorded when I
> > navigate to
> > > http://localhost/helloworld/index.jsp ?  And where is the
> > > error recorded if I
> > > mistype and navigate to http://localhost/helloworld/jndex.JSP ?
> > >
> > > Do I have to build such logging into the application?  Or
> > > does Catalina handle
> > > that for me?  And if so ... where on earth?
> > >
> > > I'm using FreeBSD installed at /usr/local/jakarta-tomcat5.0
> > >
> > > I see log information in
> > /usr/local/jakarta-tomcat5.0/logs/stderr.log
> > > and /usr/local/jakarta-tomcat5.0/logs/stdout.log but nothing
> > > that records a
> > > "page hit."
> > >
> > > Thanks,
> > >
> > > lane
> > >
> > >
> > 
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: 
> tomcat-user-help@jakarta.apache.org
> > >
> > >
> >
> >
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
> >
> >
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
> >
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: confused about simple logging

Posted by Jim Henderson <jg...@metafile.com>.
Well I am having lots of self doubt.

I am trying to install my own overloaded JDBCRealm,  I have been getting
some Sybase jdescripter error.  (My backend DB has an old means of encoding
passwords so I overloaded the getPassword method.)  I don't know if my code
is getting called or is it not.  I have System.out.... trace statements in
the constructor after the call to the super ctor as well as the getPassword
method.   And, I see none of my trace in any of the Tomcat log files.

This is frustrating after 3 days.

-----Original Message-----
From: Steve Kirk [mailto:tomcat-user@web-startup.co.uk]
Sent: Monday, May 23, 2005 1:46 PM
To: 'Tomcat Users List'
Subject: RE: confused about simple logging



Not sure, ut I think all the output streams are diverted to that file.  It's
probably configurable.  Don't know full detail to be honest.  Best wasy is
try it and see.

> -----Original Message-----
> From: Jim Henderson [mailto:jgh@metafile.com]
> Sent: Monday 23 May 2005 19:02
> To: Tomcat Users List
> Subject: RE: confused about simple logging
>
>
>
> If I write to stdout where does that go?
>
> System.stdout.println("Where does this get printed to?");
>
> I assume C:/tomcat.../log/stdout?
>
> -----Original Message-----
> From: Steve Kirk [mailto:tomcat-user@web-startup.co.uk]
> Sent: Monday, May 23, 2005 12:28 PM
> To: 'Tomcat Users List'
> Subject: RE: confused about simple logging
>
>
>
> Your confusion possibly arises because there are at least 2
> types of logger
> that you might mean, and 3 main choices for one of those at
> the moment,
> although one of those 3 is deprecated and a second is
> probably becoming less
> popular.
>
> OK I'll take a quick stab and see if this gets you anywhere
> in the right
> direction.
>
> You mention two distinct types of logging.  The 1st is the
> "hit" logging
> which is very similar to what you would get from apache
> httpd.  This simply
> logs each incoming request.  This is achieved by adding a
> <Valve> to your
> %catalina_home%\conf\server.xml - you can embed it inside the
> <Host></Host>,
> <Engine></Engine> or <Context></Context> tags, but for your
> purposes, just
> shove it in the engine for now.  It looks a bit like this:
>
> <Engine blah blah>
> 	<Valve
> className="org.apache.catalina.valves.FastCommonAccessLogValve"
> 		directory="logs"  prefix="ao_access_log_" suffix=".log"
> 		pattern="common" resolveHosts="false"/>
> </Engine>
>
> You can tweak the path, filename, and the pattern that
> defines each line -
> see
> http://jakarta.apache.org/tomcat/tomcat-5.0-doc/config/valve.html
> for details.  Leave resolveHosts set "false" to speed up performance.
>
> Not that my example above is from my own 5.5.9 server - ISTR
> 5.0 config
> syntax is different - check the doc link above for the detail.
>
> The 2nd part of your logging is where you write your own messages to a
> logfile.  I did that as follows:
>
> java.util.logging.Logger logger =
> java.util.logging.Logger.getLogger("logname");
> logger.setLevel(logLevel);
> fh = new FileHandler(logFilePath, maxLogFileSize, logFileCount, true);
> fh.setFormatter(new AoLogFormatter(logFileDateTimePattern));
> logger.addHandler(fh);
>
> Then to write a log message you can just do this:
>
> 	log("Write this to the log");
>
> and it will write the log file to logFilePath
>
> See the java.util.logging.Logger javadocs for more details.
>
> This is very basic.  Much more spophistication can be achieved through
> config files.
>
> > -----Original Message-----
> > From: Lane [mailto:lane@joeandlane.com]
> > Sent: Monday 23 May 2005 18:01
> > To: Tomcat Users List
> > Subject: confused about simple logging
> >
> >
> > Hello.
> >
> > I'm a bit confused about simple logging on tomcat 5.0.  I've
> > read much of the
> > FAQ at
> > http://jakarta.apache.org/tomcat/faq/logging.html#builtIn but that
> > doesn't seem to address what I'm looking for, which is just
> > routine mundane
> > daily activity.
> >
> > For instance, if I create and deploy a simple "Hello World"
> > application that
> > contains only index.jsp, no servlets, no external classes
> and no JNDI
> > resources, where on earth will a "hit" be recorded when I
> navigate to
> > http://localhost/helloworld/index.jsp ?  And where is the
> > error recorded if I
> > mistype and navigate to http://localhost/helloworld/jndex.JSP ?
> >
> > Do I have to build such logging into the application?  Or
> > does Catalina handle
> > that for me?  And if so ... where on earth?
> >
> > I'm using FreeBSD installed at /usr/local/jakarta-tomcat5.0
> >
> > I see log information in
> /usr/local/jakarta-tomcat5.0/logs/stderr.log
> > and /usr/local/jakarta-tomcat5.0/logs/stdout.log but nothing
> > that records a
> > "page hit."
> >
> > Thanks,
> >
> > lane
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: confused about simple logging

Posted by Steve Kirk <to...@web-startup.co.uk>.
Not sure, ut I think all the output streams are diverted to that file.  It's
probably configurable.  Don't know full detail to be honest.  Best wasy is
try it and see.

> -----Original Message-----
> From: Jim Henderson [mailto:jgh@metafile.com] 
> Sent: Monday 23 May 2005 19:02
> To: Tomcat Users List
> Subject: RE: confused about simple logging
> 
> 
> 
> If I write to stdout where does that go?
> 
> System.stdout.println("Where does this get printed to?");
> 
> I assume C:/tomcat.../log/stdout?
> 
> -----Original Message-----
> From: Steve Kirk [mailto:tomcat-user@web-startup.co.uk]
> Sent: Monday, May 23, 2005 12:28 PM
> To: 'Tomcat Users List'
> Subject: RE: confused about simple logging
> 
> 
> 
> Your confusion possibly arises because there are at least 2 
> types of logger
> that you might mean, and 3 main choices for one of those at 
> the moment,
> although one of those 3 is deprecated and a second is 
> probably becoming less
> popular.
> 
> OK I'll take a quick stab and see if this gets you anywhere 
> in the right
> direction.
> 
> You mention two distinct types of logging.  The 1st is the 
> "hit" logging
> which is very similar to what you would get from apache 
> httpd.  This simply
> logs each incoming request.  This is achieved by adding a 
> <Valve> to your
> %catalina_home%\conf\server.xml - you can embed it inside the 
> <Host></Host>,
> <Engine></Engine> or <Context></Context> tags, but for your 
> purposes, just
> shove it in the engine for now.  It looks a bit like this:
> 
> <Engine blah blah>
> 	<Valve
> className="org.apache.catalina.valves.FastCommonAccessLogValve"
> 		directory="logs"  prefix="ao_access_log_" suffix=".log"
> 		pattern="common" resolveHosts="false"/>
> </Engine>
> 
> You can tweak the path, filename, and the pattern that 
> defines each line -
> see
> http://jakarta.apache.org/tomcat/tomcat-5.0-doc/config/valve.html
> for details.  Leave resolveHosts set "false" to speed up performance.
> 
> Not that my example above is from my own 5.5.9 server - ISTR 
> 5.0 config
> syntax is different - check the doc link above for the detail.
> 
> The 2nd part of your logging is where you write your own messages to a
> logfile.  I did that as follows:
> 
> java.util.logging.Logger logger =
> java.util.logging.Logger.getLogger("logname");
> logger.setLevel(logLevel);
> fh = new FileHandler(logFilePath, maxLogFileSize, logFileCount, true);
> fh.setFormatter(new AoLogFormatter(logFileDateTimePattern));
> logger.addHandler(fh);
> 
> Then to write a log message you can just do this:
> 
> 	log("Write this to the log");
> 
> and it will write the log file to logFilePath
> 
> See the java.util.logging.Logger javadocs for more details.
> 
> This is very basic.  Much more spophistication can be achieved through
> config files.
> 
> > -----Original Message-----
> > From: Lane [mailto:lane@joeandlane.com]
> > Sent: Monday 23 May 2005 18:01
> > To: Tomcat Users List
> > Subject: confused about simple logging
> >
> >
> > Hello.
> >
> > I'm a bit confused about simple logging on tomcat 5.0.  I've
> > read much of the
> > FAQ at
> > http://jakarta.apache.org/tomcat/faq/logging.html#builtIn but that
> > doesn't seem to address what I'm looking for, which is just
> > routine mundane
> > daily activity.
> >
> > For instance, if I create and deploy a simple "Hello World"
> > application that
> > contains only index.jsp, no servlets, no external classes 
> and no JNDI
> > resources, where on earth will a "hit" be recorded when I 
> navigate to
> > http://localhost/helloworld/index.jsp ?  And where is the
> > error recorded if I
> > mistype and navigate to http://localhost/helloworld/jndex.JSP ?
> >
> > Do I have to build such logging into the application?  Or
> > does Catalina handle
> > that for me?  And if so ... where on earth?
> >
> > I'm using FreeBSD installed at /usr/local/jakarta-tomcat5.0
> >
> > I see log information in 
> /usr/local/jakarta-tomcat5.0/logs/stderr.log
> > and /usr/local/jakarta-tomcat5.0/logs/stdout.log but nothing
> > that records a
> > "page hit."
> >
> > Thanks,
> >
> > lane
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
> >
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: confused about simple logging

Posted by Jim Henderson <jg...@metafile.com>.
If I write to stdout where does that go?

System.stdout.println("Where does this get printed to?");

I assume C:/tomcat.../log/stdout?

-----Original Message-----
From: Steve Kirk [mailto:tomcat-user@web-startup.co.uk]
Sent: Monday, May 23, 2005 12:28 PM
To: 'Tomcat Users List'
Subject: RE: confused about simple logging



Your confusion possibly arises because there are at least 2 types of logger
that you might mean, and 3 main choices for one of those at the moment,
although one of those 3 is deprecated and a second is probably becoming less
popular.

OK I'll take a quick stab and see if this gets you anywhere in the right
direction.

You mention two distinct types of logging.  The 1st is the "hit" logging
which is very similar to what you would get from apache httpd.  This simply
logs each incoming request.  This is achieved by adding a <Valve> to your
%catalina_home%\conf\server.xml - you can embed it inside the <Host></Host>,
<Engine></Engine> or <Context></Context> tags, but for your purposes, just
shove it in the engine for now.  It looks a bit like this:

<Engine blah blah>
	<Valve
className="org.apache.catalina.valves.FastCommonAccessLogValve"
		directory="logs"  prefix="ao_access_log_" suffix=".log"
		pattern="common" resolveHosts="false"/>
</Engine>

You can tweak the path, filename, and the pattern that defines each line -
see
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/config/valve.html
for details.  Leave resolveHosts set "false" to speed up performance.

Not that my example above is from my own 5.5.9 server - ISTR 5.0 config
syntax is different - check the doc link above for the detail.

The 2nd part of your logging is where you write your own messages to a
logfile.  I did that as follows:

java.util.logging.Logger logger =
java.util.logging.Logger.getLogger("logname");
logger.setLevel(logLevel);
fh = new FileHandler(logFilePath, maxLogFileSize, logFileCount, true);
fh.setFormatter(new AoLogFormatter(logFileDateTimePattern));
logger.addHandler(fh);

Then to write a log message you can just do this:

	log("Write this to the log");

and it will write the log file to logFilePath

See the java.util.logging.Logger javadocs for more details.

This is very basic.  Much more spophistication can be achieved through
config files.

> -----Original Message-----
> From: Lane [mailto:lane@joeandlane.com]
> Sent: Monday 23 May 2005 18:01
> To: Tomcat Users List
> Subject: confused about simple logging
>
>
> Hello.
>
> I'm a bit confused about simple logging on tomcat 5.0.  I've
> read much of the
> FAQ at
> http://jakarta.apache.org/tomcat/faq/logging.html#builtIn but that
> doesn't seem to address what I'm looking for, which is just
> routine mundane
> daily activity.
>
> For instance, if I create and deploy a simple "Hello World"
> application that
> contains only index.jsp, no servlets, no external classes and no JNDI
> resources, where on earth will a "hit" be recorded when I navigate to
> http://localhost/helloworld/index.jsp ?  And where is the
> error recorded if I
> mistype and navigate to http://localhost/helloworld/jndex.JSP ?
>
> Do I have to build such logging into the application?  Or
> does Catalina handle
> that for me?  And if so ... where on earth?
>
> I'm using FreeBSD installed at /usr/local/jakarta-tomcat5.0
>
> I see log information in /usr/local/jakarta-tomcat5.0/logs/stderr.log
> and /usr/local/jakarta-tomcat5.0/logs/stdout.log but nothing
> that records a
> "page hit."
>
> Thanks,
>
> lane
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: confused about simple logging

Posted by Steve Kirk <to...@web-startup.co.uk>.
Your confusion possibly arises because there are at least 2 types of logger
that you might mean, and 3 main choices for one of those at the moment,
although one of those 3 is deprecated and a second is probably becoming less
popular.

OK I'll take a quick stab and see if this gets you anywhere in the right
direction.

You mention two distinct types of logging.  The 1st is the "hit" logging
which is very similar to what you would get from apache httpd.  This simply
logs each incoming request.  This is achieved by adding a <Valve> to your
%catalina_home%\conf\server.xml - you can embed it inside the <Host></Host>,
<Engine></Engine> or <Context></Context> tags, but for your purposes, just
shove it in the engine for now.  It looks a bit like this:

<Engine blah blah>
	<Valve
className="org.apache.catalina.valves.FastCommonAccessLogValve"
		directory="logs"  prefix="ao_access_log_" suffix=".log"
		pattern="common" resolveHosts="false"/>
</Engine>

You can tweak the path, filename, and the pattern that defines each line -
see 
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/config/valve.html 
for details.  Leave resolveHosts set "false" to speed up performance.

Not that my example above is from my own 5.5.9 server - ISTR 5.0 config
syntax is different - check the doc link above for the detail.

The 2nd part of your logging is where you write your own messages to a
logfile.  I did that as follows: 

java.util.logging.Logger logger =
java.util.logging.Logger.getLogger("logname");
logger.setLevel(logLevel);
fh = new FileHandler(logFilePath, maxLogFileSize, logFileCount, true);
fh.setFormatter(new AoLogFormatter(logFileDateTimePattern));
logger.addHandler(fh);

Then to write a log message you can just do this: 

	log("Write this to the log");

and it will write the log file to logFilePath

See the java.util.logging.Logger javadocs for more details.

This is very basic.  Much more spophistication can be achieved through
config files.

> -----Original Message-----
> From: Lane [mailto:lane@joeandlane.com] 
> Sent: Monday 23 May 2005 18:01
> To: Tomcat Users List
> Subject: confused about simple logging
> 
> 
> Hello.
> 
> I'm a bit confused about simple logging on tomcat 5.0.  I've 
> read much of the 
> FAQ at 
> http://jakarta.apache.org/tomcat/faq/logging.html#builtIn but that 
> doesn't seem to address what I'm looking for, which is just 
> routine mundane 
> daily activity.
> 
> For instance, if I create and deploy a simple "Hello World" 
> application that 
> contains only index.jsp, no servlets, no external classes and no JNDI 
> resources, where on earth will a "hit" be recorded when I navigate to 
> http://localhost/helloworld/index.jsp ?  And where is the 
> error recorded if I 
> mistype and navigate to http://localhost/helloworld/jndex.JSP ?
> 
> Do I have to build such logging into the application?  Or 
> does Catalina handle 
> that for me?  And if so ... where on earth?
> 
> I'm using FreeBSD installed at /usr/local/jakarta-tomcat5.0
> 
> I see log information in /usr/local/jakarta-tomcat5.0/logs/stderr.log 
> and /usr/local/jakarta-tomcat5.0/logs/stdout.log but nothing 
> that records a 
> "page hit."
> 
> Thanks,
> 
> lane
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org