Reputation: 2311
I want to use looging from a jsp page and I have initialised the loggger as shown.
Logger logger = Logger.getLogger( "sample.jsp" );
But when I try to log any startements as logger.log("Sample Output");
, its giving me the following exception.
The method log(String, Priority, Object, Throwable) in the type Category is not applicable for the arguments (String)
Why is this error occurring and how can I solve the same.
Upvotes: 0
Views: 516
Reputation: 3390
Because there is no such method.
Use more appropriate methods like: fatal()
, error()
, info()
, debug()
etc.
Check documentation here:
http://logging.apache.org/log4j/1.2/apidocs/index.html
The error says, method expects these arguments:
log(String, Priority, Object, Throwable)
But you are passing only String
.
Upvotes: 4
Reputation: 705
Use below code in your JSP
<% Logger logger=Logger.getLogger(this.getClass().getName());%>
Upvotes: 0