Re: AccessLogUtil and minor patch to AccessLogValve

2001-01-13 Thread Jon Stevens

on 1/12/01 11:52 PM, "David Weinrich" <[EMAIL PROTECTED]> wrote:

> In diving through the documentation I found for log4j, and hitting the
> website I noticed...it is now part of the jakarta project (yay!). Seems like
> this would be a (much much much) better idea than my mostly-untested syslog
> code for an addition to the logger classes, any thoughts on this?
> 
> David Weinrich

+1. Use log4j.

-jon

-- 
Honk if you love peace and quiet.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: AccessLogUtil and minor patch to AccessLogValve

2001-01-13 Thread Craig R. McClanahan

David Weinrich wrote:

> In diving through the documentation I found for log4j, and hitting the
> website I noticed...it is now part of the jakarta project (yay!). Seems like
> this would be a (much much much) better idea than my mostly-untested syslog
> code for an addition to the logger classes, any thoughts on this?
>

Now that it's an Apache project, I am +1 for using it ... both here, and as an
implementation of org.apache.catalina.Logger for the general purpose logging
that goes on inside Catalina.

I will be examining your patches (and Kief's work on session persistence) over
the weekend -- look for some commits and/or questions later on.

>
> David Weinrich
>

Craig McClanahan



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: AccessLogUtil and minor patch to AccessLogValve

2001-01-12 Thread David Weinrich

In diving through the documentation I found for log4j, and hitting the
website I noticed...it is now part of the jakarta project (yay!). Seems like
this would be a (much much much) better idea than my mostly-untested syslog
code for an addition to the logger classes, any thoughts on this?

David Weinrich


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




AccessLogUtil and minor patch to AccessLogValve

2001-01-12 Thread David Weinrich

Time for another installment of the AccessLogUtil, this time the parser is
( nearly ) done and handles most of the possible entries that the apache
mod_log_config does are present ( including filtering an entry based on
status code and parameters to a particular entry type ). The docs for that
module are at:

http://httpd.apache.org/docs/mod/mod_log_config.html

The stuff that I have questions about or haven't implemented yet are as
follows:

%...c:Connection status when response is completed.
  'X' = connection aborted before the response completed.
  '+' = connection may be kept alive after the response is
sent.
  '-' = connection will be closed after the response is sent.
Notes:
  * I'm not sure exactly where I would grab the connection aborted
case from ( mostly this was a low priority item, I will dig
through the code and try to locate that a little later ).


%...{FOOBAR}e:  The contents of the environment variable FOOBAR
and
%...{Foobar}n:  The contents of note "Foobar" from another module.

and
%...P:  The process ID of the child that serviced the request.

Notes:
  * I don't know these are meaningful/useful in this particular
environment.

%...{Foobar}o:  The contents of Foobar: header line(s) in the reply.

Notes:
  * This is present *but* response headers that are set internally
( Content-Length and Content-Type are two I ran up against so
far ) aren't yet available. I can fix this in the parser if these
two are the only response headers that get snagged by this.

%...s:Status.  For requests that got internally redirected,
  this is the status of the *original* request ---
  %...>s for the last.

Notes:
  * Not sure exactly what the > would mean in this particular
environment, if I'm reading it correctly this is done by
default the way this is implemented but I don't think I am
reading this correctly.

%...{format}t:  The time, in the form given by format, which should
be in strftime(3) format. (potentially localized)

Notes:
  * For now this actually would take a java.text.SimpleDateFormat
style format. If needed I might be able to parse strtime
formats too but...one thing at a time. I've also added a
shortcut ISO for ISO style timestamp output
"-MM-dd HH:mm:ss (+|-)offset".

%...T:  The time taken to serve the request, in seconds.

Notes:
  * Not implemented yet, I'm still trying to figure out a clean
or sane way to do this. So far it looks like the most
straightforward way I've looked at would be to have the
calling valve invoke a 'beforeResponse()' and
'afterResponse()' method but that seems like something of
an ugly solution.

%...v:  The canonical ServerName of the server serving the request.
%...V:  The server name according to the UseCanonicalName setting.

Notes:
  * Is this distinction meaningful in this environment? Right now
the values returned are identical.

I hope this is a fairly useful utility class, the next steps I will
probably take include:

1) Test and retest the parser.
2) Hopefully clarify the items included above and fix.
3) Add additional items available in tomcat but not in mod_log_config.
4) Add a second configuration method that allows the client of this class
   to add arbitrary items by name and store a foreign name for that item
   ( mostly useful for JDBCAccessLog ).

In addition I have some minimal syslog client code sitting around
gathering dust, I know one or two people have requested syslog logs
and access logs. If someone wants I can clean this code up and create
a org.apache.catalina.logger.SyslogLogger class.

One last note: while looking around in AccessLogValve I noticed a
peculiarity in the way the first file opened always lacked the date
stamp. The patch for that is attached.

Thanks for your patience ( this email is a bit lengthy I know ), again any
ideas/critiques/pointers are more than welcome.

David Weinrich



--- AccessLogValve.java Fri Jan 12 22:59:34 2001
+++ AccessLogValveEd.java   Fri Jan 12 22:58:04 2001
@@ -528,7 +528,6 @@
 if (!dateStamp.equals(tsDate)) {
 synchronized (this) {
 close();
-dateStamp = tsDate;
 open();
 }
 }
@@ -572,6 +571,10 @@
dir = new File(System.getProperty("catalina.home") +
   File.separator + directory);
dir.mkdirs();
+
+// set the dateStamp here, avoiding the creation of a dateStamp-less
+// log the first day of use...
+dateStamp = dateFormatter.format(currentDate);
 
// Open the current log file
try {

 TestAccessLogValve.java
 AccessLogUtil.java

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED