I am developing a mobile application and im using log4j to display information. I want to use log4j to display information on the console which it is doing correctly but i am having trouble when I try adding a SMTPAppender to send a email when ever an error occurs. It is not displaying an error but the tomcat does not start correctly when I start it with the SMTPAppender is added.
I am using Apache Tomcat 7.0.23
This is my log4j.properties file
log4j.rootCategory=TRACE, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
# Pattern to output the caller's file name and line number.
log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} [application] %-5p %m%n
log4j.rootCategory=ERROR, mail
log4j.appender.mail=org.apache.log4j.net.SMTPAppender
#defines how often emails are send
log4j.appender.mail.BufferSize=1
log4j.appender.mail.SMTPHost=smtp.gmail.com
log4j.appender.mail.SMTPUsername=******* #not the username im using
log4j.appender.mail.SMTPPassword=******* #not the password im using
log4j.appender.mail.From=info@gmail.com
log4j.appender.mail.To=noc@gmail.com
log4j.appender.mail.Subject="Application.log error occurred"
log4j.appender.mail.layout=org.apache.log4j.PatternLayout
log4j.appender.mail.layout.ConversionPattern=%d{ISO8601} [application] %-5p %m%n
This is my console
Found binding in [jar:file:/C:/Documents%20and%20Settings/noconnor/.m2/repository/org/slf4j/slf4j-simple/1.6.1/slf4j-simple-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Documents%20and%20Settings/noconnor/.m2/repository/org/slf4j/slf4j-log4j12/1.6.2/slf4j-log4j12-1.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
is this the correct way to add a second appender or am i making a mistake somewhere?