Discussion:
using log4j in jsp
Denis McCarthy
2002-07-04 15:55:08 UTC
Permalink
Hi,
I'm using log4j as my logger in a web application. This is all well and good
for my back end (control ,business and data access tiers) but I'm stumped
about what the best approach is to using log4j in my front end (jsp pages).
Has anyone out there used log4j in jsp pages, and if so what if any
strategies have they implemented to deal with things like logger
inheritance?
Thanks
Denis
Kevin Steppe
2002-07-04 23:53:54 UTC
Permalink
I do the following:

<!-- Boiler plate page included by all pages -->
<% page import="com.mystuff.WebInit" %>
<%
WebInit.Init(); //this static method checks if log4j is configured,
if not WebInit.Init() configures log4j
String page = request.getParameter("URL");
org.apache.log4j.Logger log =
org.apache.log4j.Logger.getLogger("com.mystuff.web." + page);

if (page != "login.jsp" && session.getAttribute("login") == null)
{
session.setAttribute("target", page);
response.sendRedirect("login.jsp");
return;
}
%>

Kevin
Post by Denis McCarthy
Hi,
I'm using log4j as my logger in a web application. This is all well and good
for my back end (control ,business and data access tiers) but I'm stumped
about what the best approach is to using log4j in my front end (jsp pages).
Has anyone out there used log4j in jsp pages, and if so what if any
strategies have they implemented to deal with things like logger
inheritance?
Thanks
Denis
--
rayaku
2002-03-05 07:24:48 UTC
Permalink
Hi,
I would like to do log4j setup in my web application.
As per suggestions in net i kept my mylog4j.properties file in
web-inf\classes
and below statments exists in it.

log4j.appender.R.File=example.log

when i searched for this file in my tomcat i found it in tomcatlocation\bin
directory with
correct log output .

Can i move this(example.log) file to any desired location other than
\bin(default)?
And as mylog4j.properties file is under web-inf\classes when i change the
file
the changes are not effected untill tomcat is restarted.

Can i keep this file under webapps/mywebapp location so that it works
fine(guessing).

Bye
</rayaku>
Jochen Hiller
2002-07-05 14:32:39 UTC
Permalink
Hi Denis,

I've written a tag library which will be used in our company projects. Also,
as part of the jakarta-taglibs there is a <log> tag support. See
http://jakarta.apache.org

If I should provide you with the code, let me know.

Bye, Jochen

-----Original Message-----
From: Denis McCarthy [mailto:***@omnipaygroup.com]
Sent: Donnerstag, 4. Juli 2002 17:55
To: Log4J Users List
Subject: using log4j in jsp


Hi,
I'm using log4j as my logger in a web application. This is all well and good
for my back end (control ,business and data access tiers) but I'm stumped
about what the best approach is to using log4j in my front end (jsp pages).
Has anyone out there used log4j in jsp pages, and if so what if any
strategies have they implemented to deal with things like logger
inheritance?
Thanks
Denis


--
To unsubscribe, e-mail: <mailto:log4j-user-***@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-user-***@jakarta.apache.org>
g***@tarsec.com
2002-07-07 09:58:05 UTC
Permalink
I'm interested, too. You might also think about putting it into the Sourceforge
Snippet library.

Regards
-Bernd.
Post by Jochen Hiller
Hi Denis,
I've written a tag library which will be used in our company projects. Also,
as part of the jakarta-taglibs there is a <log> tag support. See
http://jakarta.apache.org
If I should provide you with the code, let me know.
Bye, Jochen
-----Original Message-----
Sent: Donnerstag, 4. Juli 2002 17:55
To: Log4J Users List
Subject: using log4j in jsp
Hi,
I'm using log4j as my logger in a web application. This is all well and good
for my back end (control ,business and data access tiers) but I'm stumped
about what the best approach is to using log4j in my front end (jsp pages).
Has anyone out there used log4j in jsp pages, and if so what if any
strategies have they implemented to deal with things like logger
inheritance?
Thanks
Denis
--
--
--
Bernd Goetz ***@tarsec.com
TARSEC AG Tel +41 1 496 61 11
Rautistrasse 12 Fax +41 1 496 61 99
Postfach Mobile +41 79 759 04 26
8047 Zurich, Switzerland http://www.tarsec.com
Mark Womack
2002-07-08 17:24:16 UTC
Permalink
Denis,

I make up logger names for the jsp pages, since you cannot predict what the
jsp java name will be (and you probably don't want to use it anyway since it
is so long).

Also, I use a mix of tags and direct java classes and use which ever one is
appropriate for the place I am logging a message.

hope it helps,
-Mark
Post by Jochen Hiller
-----Original Message-----
Sent: Thursday, July 04, 2002 8:55 AM
To: Log4J Users List
Subject: using log4j in jsp
Hi,
I'm using log4j as my logger in a web application. This is
all well and good
for my back end (control ,business and data access tiers)
but I'm stumped
about what the best approach is to using log4j in my front
end (jsp pages).
Has anyone out there used log4j in jsp pages, and if so what if any
strategies have they implemented to deal with things like logger
inheritance?
Thanks
Denis
--
Loading...