The parameter to the Category.getInstance(String name) is just some name to
look for in the properties. That is, you do not HAVE to use a class name
(although that is the preffered technique). Since JSPs get translated into
servlets with a hidden classname, you can make up your own heirarchy for
pages. I'd use the relative pathing from the Web context with "jsp" as the
root level.
So, lets say I'm doing logging in the following JSP file
myapp/jsp/authentication/login.jsp :
<% Category cat = Category.getInstance("jsp.authentication.login"); %>
You could even just use "jsp" if you want ALL jsp pages to log in the same
manner. If there is a log4j.category.jsp entry in your properties, it will
get used. Otherwise, you inherit from the the rootCategory.
That should get you started...
-----Original Message-----
From: Tom Bednarz [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 11.October 2001 10:39
To: log4j user list
Subject: Using log4j in JSP's
Hello,
Can log4j be used in JSP's? If so how?
The problem is, that I have to do something like:
class myClass
{
static Cateory cat = Category.getInstance(myClass.class);
........
}
The problem is, that I do not know the name of the class since it is
generated by the jsp compiler. I currently use jRun. A JSP named myPage
will become jrun__myClass2ejspb. This is for sure different when I use a
different application server.
Has anybody a suggestion how this problem could be solved?
Thomas
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]