Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within JSP
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Liutauras Vilda
Paul Clapham
Sheriffs:
paul wheaton
Tim Cooke
Henry Wong
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Piet Souris
Bartenders:
Mike London
Forum:
JSP
How to call logger class in jsp file
Ramasubramaniam Rathinasubbu
Ranch Hand
Posts: 44
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Dear all,
I am using log4j in my web application.
in
java
class i can call ,
but in
jsp
how can i call the Logger class
and how can i call log.info("hi ");
Ravishanker kumar
Ranch Hand
Posts: 53
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
You can call logger on jsp as well. Just import required java classes on jsp using import page directive as below,
<%@ page import="org.apache.log4j.Logger" %>
and use logger.
Bear Bibeault
Sheriff
Posts: 67695
173
I like...
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Modern JSPs should have no java code in them. Logging should not be necessary.
[
Asking smart questions
] [
About Bear
] [
Books by Bear
]
Ramasubramaniam Rathinasubbu
Ranch Hand
Posts: 44
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Yes i am using same thing
in java
import org.apache.log4j.Logger;
static Logger log = Logger.getLogger(CandidateQuery.class);
then we are calling
log.info("hi");
log.Error("hi");
like that
but inside the jsp file
how can i call the log.info();
Harpreet Singh janda
Ranch Hand
Posts: 317
I like...
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
You can use the same code in JSP inside the scriptlets.
Ramasubramaniam Rathinasubbu
Ranch Hand
Posts: 44
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Thanks,
how can i call
<%@ page import="org.apache.log4j.Logger" %>
<%
static Logger log = Logger.getLogger("jspname");
log.info("hi");
%>
you are telling like this. If i call like this it saying error.
Bear Bibeault
Sheriff
Posts: 67695
173
I like...
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Wow. The time to be putting Java code in JSPs ended in 2002.
[
Asking smart questions
] [
About Bear
] [
Books by Bear
]
Harpreet Singh janda
Ranch Hand
Posts: 317
I like...
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
What error?
Try with non static logger object.
Don't get me started about those stupid
light bulbs
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
logging API in 1.4
Customize Logger Problem
inject log4j logger
log4j.xml logger name
How to encapsulate Logger info
More...