You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Denis McCarthy <dm...@omnipaygroup.com> on 2002/07/04 17:55:08 UTC

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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: using log4j in jsp

Posted by Kevin Steppe <ks...@pacbell.net>.
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


Denis McCarthy wrote:

>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:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Newbie question: Log4j Setup

Posted by rayaku <ya...@nous.soft.net>.
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>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: using log4j in jsp

Posted by go...@tarsec.com.
I'm interested, too. You might also think about putting it into the Sourceforge 
Snippet library.

Regards
-Bernd.

Jochen Hiller wrote:
> 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:dmccarthy@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:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 



-- 
Bernd Goetz                                     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


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: using log4j in jsp

Posted by Jochen Hiller <jo...@bauer-partner.com>.
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:dmccarthy@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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>