logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Karen Goh <karenwo...@yahoo.com.INVALID>
Subject Not able to get logging printout to console, email etc
Date Wed, 17 Apr 2019 05:44:12 GMT
Hi,

I have been trying to make netbeans IDE to churn out a log to see what's causing the error
in my web app.

Tomcat : 8.0.27
OS : Windows 10

I have created the following log4j.properties which I put under WEB-INF


# To change this license header, choose License Headers in Project Properties.
# To change this template file, choose Tools | Templates
# and open the template in the editor.
# Root logger option
log4j.rootLogger=INFO, stdout, Email, DB

# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
log4j.appender.console.immediateFlush=true
log4j.appender.console.encoding=UTF-8


log4j.appender.Email=org.apache.log4j.net.SMTPAppender
log4j.appender.Email.BufferSize=512
log4j.appender.Email.Threshold=ERROR
log4j.appender.Email.SMTPHost=smtp.gmail.com
log4j.appender.Email.SMTPUsername=xxx@gmail.com
log4j.appender.Email.SMTPPassword=xxx
log4j.appender.Email.From= xxx@gmail.com
log4j.appender.Email.To=karenworld@yahoo.com
log4j.appender.Email.Subject=Error Report
log4j.appender.Email.layout=org.apache.log4j.PatternLayout
log4j.appender.Email.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n


log4j.rootCategory=DEBUG


log4j.appender.DB=org.apache.log4j.jdbc.JDBCAppender 
log4j.appender.DB.driver=org.postgresql.Driver
log4j.appender.DB.URL="jdbc:postgresql://localhost:5432/membership" 
log4j.appender.DB.user=membership
log4j.appender.DB.password=travel8
log4j.appender.DB.sql=INSERT INTO log4j_messages (message, class, priority, log_date) values
('%m', '%c', '%p', to_timestamp('%d', 'YYYY-MM-DD HH24:MI:SS,MS'))


But, it is not printing out anything to the console.

And the last tomcat log keeps giving something that was done earlier: 

17-Apr-2019 11:10:34.677 SEVERE [http-nio-8084-exec-17] org.apache.catalina.core.StandardWrapperValve.invoke
Servlet.service() for servlet [ProcessRegistration] in context with path [/WebApplication1]
threw exception [Servlet execution threw an exception] with root cause
 java.lang.ClassNotFoundException: org.slf4j.Logger

Here are the libraries I have used:

log4j-core-2.11.2.jar
lo4j-to-slf4j-2.11.2.jar
log4j-web-2.11.2.jar
log4j-api-2.11.2.jar
slf4j-api-1.7.25.jar


<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->

<configuration status="trace">
  <appenders>
    <Console name="Console" target="SYSTEM_OUT">
      <PatternLayout pattern="%d{HH:mm:ss} [%t] %-5level %logger{36} - %msg%n"/>
   </Console>
  </appenders>

  <loggers>
    <root level="trace">
      <appender-ref ref="console" level="trace" additivity="true"/>
    </root>
  </loggers>
</configuration>

Any help that point out where I have gone wrong is greatly appreciated 

Tks & rgds,
Karen

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message