Re: [PROPOSAL] Tomcat 4 System.err/System.out logging

2002-05-23 Thread Remy Maucherat

 I have taken the org.apache.jasper.util.SystemLogHandler Remy wrote
 and put it in org.apache.tomcat.util.log.SystemLogHandler.

 I refactored it so that the PrintStreams and Byte arrays are recycle.
 Plus implemented a stack so that there can be nested usage.

 Finally, I implemented it in Tomcat 4 so that any System.out or System.err
 output generated when handling a request is sent to the appropriate
 web application context log.

 Remy, you may want to switch jasper2 over to using this, then remove
 org.apache.jasper.util.SystemLogHandler.

This looks good. Originally, I had put it in j-t-c/util/log as you did, but
at the moment Jasper 2 can't depend on stuff from j-t-c/util. (Jasper JARs
are
in common/lib, while j-t-c/util is in server/lib)
Given that there's a lot of unprotected static methods in there, I would see
it
as a possible security risk to move it to common/lib.

Remy


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




Re: [PROPOSAL] Tomcat 4 System.err/System.out logging

2002-05-23 Thread Andrew Houghton

Wouldn't this introduce a dependency on Tomcat JARs for Jasper 2?  I can 
think of at least one project off hand that uses Jasper standalone; it 
seems a shame to change this, since Jasper 2 is currently engine-agnostic.

- a.

Glenn Nielsen wrote:
 I have taken the org.apache.jasper.util.SystemLogHandler Remy wrote
 and put it in org.apache.tomcat.util.log.SystemLogHandler.
 
 I refactored it so that the PrintStreams and Byte arrays are recycle.
 Plus implemented a stack so that there can be nested usage.
 
 Finally, I implemented it in Tomcat 4 so that any System.out or System.err
 output generated when handling a request is sent to the appropriate
 web application context log.
 
 Remy, you may want to switch jasper2 over to using this, then remove
 org.apache.jasper.util.SystemLogHandler.
 
 Glenn
 
 Remy Maucherat wrote:
 
Remy Maucherat wrote:

How is Ant implemented within Tomcat for doing JSP compiles?

I am concerned about Ant running within the same JVM and having to capture
the JVM's System.out and System.err.  Other output from catalina could get
intermixed with the Ant output.  Also I saw something about synchronizing
of compiles being required.

If the compiler is run within the same thread as the request, then the
filtering can be done.
I presume all out of process compilers would suffer from that problem.

However, I'd like to point out that there's no other choice but to upgrade.
In many situations, the current Jasper 2 generated servlets don't compile to
valid bytecode when using the classic compiler (and you get a VerifyError
when loading the class; this happens esp when using JSTL). The J2SE team
hasn't touched the old compiler code for more than 2 years, and refuse to
fix bugs :-(

Remy

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


-- 
Andrew Houghton
[EMAIL PROTECTED]


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




RE: [PROPOSAL] Tomcat 4 System.err/System.out logging

2002-05-21 Thread John Trollinger

The other problem with logging is that messages logged without a trace
level are not given a default trace level so there is no way to stop
those messages from being displayed.  Why are messages not given a
default log level if they are not created with one.

John

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
On Behalf Of Glenn Nielsen
Sent: Tuesday, May 21, 2002 8:01 AM
To: [EMAIL PROTECTED]
Subject: [PROPOSAL] Tomcat 4 System.err/System.out logging


Problem
---

Frequently code running within a web application context will print to
System.out, System.err, printStackTrace(), etc.  This output ends up
getting logged to catalina.out without any timestamps. When you have
multiple virtual hosts/contexts it can be a pain to correlate the stack
traces and other output in catalina.out with the web application context
which generated it.

Proposed Solution
-

1.  Create a JNDI named resource for the ServletContext
(java:comp/env/context) scoped to the web application.

2.  Create a custom PrintStream object which uses the above
JNDI named resource to find which ServletContext to direct
output to.  If no context is found, it prints to the default
System.err and System.out.  If a ServletContext is found it uses
its log method for output.

3.  On Tomcat startup use System.setErr() and System.setOut() to
replace the default PrintStream with the above custom PrintStream.


Comments, suggestions, and alternate solutions are welcome. :-)

Regards,

Glenn

--
Glenn Nielsen [EMAIL PROTECTED] | /* Spelin donut madder|
MOREnet System Programming   |  * if iz ina coment.  |
Missouri Research and Education Network  |  */   |
--

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


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




Re: [PROPOSAL] Tomcat 4 System.err/System.out logging

2002-05-21 Thread Remy Maucherat

 Problem
 ---

 Frequently code running within a web application context will print
 to System.out, System.err, printStackTrace(), etc.  This output ends
 up getting logged to catalina.out without any timestamps. When
 you have multiple virtual hosts/contexts it can be a pain to correlate
 the stack traces and other output in catalina.out with the web application
 context which generated it.

 Proposed Solution
 -

 1.  Create a JNDI named resource for the ServletContext
 (java:comp/env/context) scoped to the web application.

 2.  Create a custom PrintStream object which uses the above
 JNDI named resource to find which ServletContext to direct
 output to.  If no context is found, it prints to the default
 System.err and System.out.  If a ServletContext is found it uses
 its log method for output.

 3.  On Tomcat startup use System.setErr() and System.setOut() to
 replace the default PrintStream with the above custom PrintStream.


 Comments, suggestions, and alternate solutions are welcome. :-)

There's a (small) problem. The new compiler (needed for Jasper 2) and Ant
require that the Sys.err (and/or Sys.out) is captured to actually display
error messages.
That proposal must be modified to allow temporarily capturing a thread's
Sys.out output, and put it in a String (in addition to the logging features
you mentioned).

Since this class is needed in Jasper (for other components, it's just an
enhancement), it must be independent of Catalina (your proposal seems to be
ok for that) and should be put in j-t-c/util.

To summarize, that's a great timing for your proposal (I have the Ant
compiler working at the moment, but I still need to do the output capture)
:)

Remy


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




Re: [PROPOSAL] Tomcat 4 System.err/System.out logging

2002-05-21 Thread Glenn Nielsen



Remy Maucherat wrote:

Problem
---

Frequently code running within a web application context will print
to System.out, System.err, printStackTrace(), etc.  This output ends
up getting logged to catalina.out without any timestamps. When
you have multiple virtual hosts/contexts it can be a pain to correlate
the stack traces and other output in catalina.out with the web application
context which generated it.

Proposed Solution
-

1.  Create a JNDI named resource for the ServletContext
(java:comp/env/context) scoped to the web application.

2.  Create a custom PrintStream object which uses the above
JNDI named resource to find which ServletContext to direct
output to.  If no context is found, it prints to the default
System.err and System.out.  If a ServletContext is found it uses
its log method for output.

3.  On Tomcat startup use System.setErr() and System.setOut() to
replace the default PrintStream with the above custom PrintStream.


Comments, suggestions, and alternate solutions are welcome. :-)

 
 There's a (small) problem. The new compiler (needed for Jasper 2) and Ant
 require that the Sys.err (and/or Sys.out) is captured to actually display
 error messages.
 That proposal must be modified to allow temporarily capturing a thread's
 Sys.out output, and put it in a String (in addition to the logging features
 you mentioned).
 
 Since this class is needed in Jasper (for other components, it's just an
 enhancement), it must be independent of Catalina (your proposal seems to be
 ok for that) and should be put in j-t-c/util.
 
 To summarize, that's a great timing for your proposal (I have the Ant
 compiler working at the moment, but I still need to do the output capture)
 :)




How is Ant implemented within Tomcat for doing JSP compiles?

I am concerned about Ant running within the same JVM and having to capture
the JVM's System.out and System.err.  Other output from catalina could get
intermixed with the Ant output.  Also I saw something about synchronizing
of compiles being required.

 
 Remy
 

Regards,

Glenn

--
Glenn Nielsen [EMAIL PROTECTED] | /* Spelin donut madder|
MOREnet System Programming   |  * if iz ina coment.  |
Missouri Research and Education Network  |  */   |
--


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




Re: [PROPOSAL] Tomcat 4 System.err/System.out logging

2002-05-21 Thread Remy Maucherat

 Remy Maucherat wrote:

 How is Ant implemented within Tomcat for doing JSP compiles?

 I am concerned about Ant running within the same JVM and having to capture
 the JVM's System.out and System.err.  Other output from catalina could get
 intermixed with the Ant output.  Also I saw something about synchronizing
 of compiles being required.

If the compiler is run within the same thread as the request, then the
filtering can be done.
I presume all out of process compilers would suffer from that problem.

However, I'd like to point out that there's no other choice but to upgrade.
In many situations, the current Jasper 2 generated servlets don't compile to
valid bytecode when using the classic compiler (and you get a VerifyError
when loading the class; this happens esp when using JSTL). The J2SE team
hasn't touched the old compiler code for more than 2 years, and refuse to
fix bugs :-(

Remy


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




Re: [PROPOSAL] Tomcat 4 System.err/System.out logging

2002-05-21 Thread Pier Fumagalli

Remy Maucherat [EMAIL PROTECTED] wrote:

 Remy Maucherat wrote:
 
 How is Ant implemented within Tomcat for doing JSP compiles?
 
 I am concerned about Ant running within the same JVM and having to capture
 the JVM's System.out and System.err.  Other output from catalina could get
 intermixed with the Ant output.  Also I saw something about synchronizing
 of compiles being required.
 
 If the compiler is run within the same thread as the request, then the
 filtering can be done.
 I presume all out of process compilers would suffer from that problem.
 
 However, I'd like to point out that there's no other choice but to upgrade.
 In many situations, the current Jasper 2 generated servlets don't compile to
 valid bytecode when using the classic compiler (and you get a VerifyError
 when loading the class; this happens esp when using JSTL). The J2SE team
 hasn't touched the old compiler code for more than 2 years, and refuse to
 fix bugs :-(

I'm wondering how hard it would be to use BCEL associated with some extended
JavaCC grammar for JSPs... Bah...

Pier


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




Re: [PROPOSAL] Tomcat 4 System.err/System.out logging

2002-05-21 Thread Kin-Man Chung


  
  However, I'd like to point out that there's no other choice but to upgrade.
  In many situations, the current Jasper 2 generated servlets don't compile to
  valid bytecode when using the classic compiler (and you get a VerifyError
  when loading the class; this happens esp when using JSTL). The J2SE team
  hasn't touched the old compiler code for more than 2 years, and refuse to
  fix bugs :-(
 
 I'm wondering how hard it would be to use BCEL associated with some extended
 JavaCC grammar for JSPs... Bah...
 
 Pier

A distinct possibility, at least for the pages where scriptlets are not
used, in which case JavaCC would not be even needed.


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




Re: [PROPOSAL] Tomcat 4 System.err/System.out logging

2002-05-21 Thread Pier Fumagalli

Kin-Man Chung [EMAIL PROTECTED] wrote:

 
 
 However, I'd like to point out that there's no other choice but to upgrade.
 In many situations, the current Jasper 2 generated servlets don't compile to
 valid bytecode when using the classic compiler (and you get a VerifyError
 when loading the class; this happens esp when using JSTL). The J2SE team
 hasn't touched the old compiler code for more than 2 years, and refuse to
 fix bugs :-(
 
 I'm wondering how hard it would be to use BCEL associated with some extended
 JavaCC grammar for JSPs... Bah...
 
 Pier
 
 A distinct possibility, at least for the pages where scriptlets are not
 used, in which case JavaCC would not be even needed.

Yes, thought of that, and if you consider that with tag libraries now anyone
with a little clue shouldn't put scriplets in pages anymore, it might be as
well worth (maybe) investigating...

I know that with XSLTC they got some pretty good performance compared to
static DTM interpretation (which is very fast as well given the structure of
DTM itself)...

I don't have time/bandwidth/knowledge to do that, but I believe it should be
put in the todo items for someone with the capacity and resources to tackle,
right?

Pier

--
[Perl] combines all the worst aspects of C and Lisp:  a billion of different
sublanguages in  one monolithic executable.  It combines the power of C with
the readability of PostScript. [Jamie Zawinski - DNA Lounge - San Francisco]


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