logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Goers <ralph.go...@dslextreme.com>
Subject Re: Not able to get logging printout to console, email etc
Date Tue, 30 Apr 2019 14:37:35 GMT
Karen,

I am finding it impossible to tell what of the below is from you vs what was from Remko.

Ralph

> On Apr 30, 2019, at 6:55 AM, Karen Goh <karenworld@yahoo.com.INVALID> wrote:
> 
> 
> --------------------------------------------
> On Tue, 4/30/19, Remko Popma <remko.popma@gmail.com> wrote:
> 
> Subject: Re: Not able to get logging printout to console, email etc
> To: "Log4J Users List" <log4j-user@logging.apache.org>
> Date: Tuesday, April 30, 2019, 7:03 PM
> 
> Hi Karen,
> 
> Did you have a chance to look at Ralph’s
> answer in detail?
> 
> Hi Remko, I searched my emails including the spam folder but there is nothing from Ralp.
> 
> I would appreciate it if you could provide me with a URL if there is one.
> 
> I have now the below errors which I hope someone can tell me what I am missing in my
log4j2 with slf4j set-up.
> 
> The web jar is also included in the reference library in the project.
> 
> 
> DEBUG StatusLogger Using ShutdownCallbackRegistry class org.apache.logging.log4j.core.util.DefaultShutdownCallbackRegistry
> INFO StatusLogger Log4j appears to be running in a Servlet environment, but there's no
log4j-web module available. If you want better web container support, please add the log4j-web
JAR to your web archive or server lib directory.
> INFO StatusLogger Log4j appears to be running in a Servlet environment, but there's no
log4j-web module available. If you want better web container support, please add the log4j-web
JAR to your web archive or server lib directory.
> DEBUG StatusLogger Took 1.553758 seconds to load 206 plugins from ParallelWebappClassLoader
>  context: webApp
>  delegate: false
> ----------> Parent Classloader:
> java.net.URLClassLoader@32d992b2
> 
> DEBUG StatusLogger PluginManager 'Converter' found 44 plugins
> DEBUG StatusLogger Starting OutputStreamManager SYSTEM_OUT.false.false-1
> DEBUG StatusLogger Starting LoggerContext[name=4a253ef, org.apache.logging.log4j.core.LoggerContext@762cf595]...
> DEBUG StatusLogger Reconfiguration started for context[name=4a253ef] at URI null (org.apache.logging.log4j.core.LoggerContext@762cf595)
with optional ClassLoader: null
> INFO StatusLogger Log4j appears to be running in a Servlet environment, but there's no
log4j-web module available. If you want better web container support, please add the log4j-web
JAR to your web archive or server lib directory.
> DEBUG StatusLogger PluginManager 'ConfigurationFactory' found 4 plugins
> INFO StatusLogger Log4j appears to be running in a Servlet environment, but there's no
log4j-web module available. If you want better web container support, please add the log4j-web
JAR to your web archive or server lib directory.
> INFO StatusLogger Log4j appears to be running in a Servlet environment, but there's no
log4j-web module available. If you want better web container support, please add the log4j-web
JAR to your web archive or server lib directory.
> DEBUG StatusLogger Missing dependencies for Yaml support, ConfigurationFactory org.apache.logging.log4j.core.config.yaml.YamlConfigurationFactory
is inactive
> INFO StatusLogger Log4j appears to be running in a Servlet environment, but there's no
log4j-web module available. If you want better web container support, please add the log4j-web
JAR to your web archive or server lib directory.
> DEBUG StatusLogger Missing dependencies for Json support, ConfigurationFactory org.apache.logging.log4j.core.config.json.JsonConfigurationFactory
is inactive
> INFO StatusLogger Log4j appears to be running in a Servlet environment, but there's no
log4j-web module available. If you want better web container support, please add the log4j-web
JAR to your web archive or server lib directory.
> DEBUG StatusLogger Using configurationFactory org.apache.logging.log4j.core.config.ConfigurationFactory$Factory@5fc1428c
> TRACE StatusLogger Trying to find [log4j2-test4a253ef.properties] using context class
loader ParallelWebappClassLoader
>  context: webApp
>  delegate: false
> ----------> Parent Classloader:
> java.net.URLClassLoader@32d992b2
> .
> TRACE StatusLogger Trying to find [log4j2-test4a253ef.properties] using ParallelWebappClassLoader
>  context: webApp
>  delegate: false
> ----------> Parent Classloader:
> java.net.URLClassLoader@32d992b2
> class loader.
> TRACE StatusLogger Trying to find [log4j2-test4a253ef.properties] using ParallelWebappClassLoader
>  context: webApp
>  delegate: false
> ----------> Parent Classloader:
> java.net.URLClassLoader@32d992b2
> class loader.
> TRACE StatusLogger Trying to find [log4j2-test4a253ef.properties] using ClassLoader.getSystemResource().
> TRACE StatusLogger Trying to find [log4j2-test4a253ef.yml] using context class loader
ParallelWebappClassLoader
>  context: webApp
>  delegate: false
> ----------> Parent Classloader:
> java.net.URLClassLoader@32d992b2
> .
> TRACE StatusLogger Trying to find [log4j2-test4a253ef.yml] using ParallelWebappClassLoader
>  context: webApp
>  delegate: false
> ----------> Parent Classloader:
> java.net.URLClassLoader@32d992b2
> class loader.
> TRACE StatusLogger Trying to find [log4j2-test4a253ef.yml] using ParallelWebappClassLoader
>  context: webApp
>  delegate: false
> ----------> Parent Classloader:
> java.net.URLClassLoader@32d992b2
> class loader.
> TRACE StatusLogger Trying to find [log4j2-test4a253ef.yml] using ClassLoader.getSystemResource().
> TRACE StatusLogger Trying to find [log4j2-test4a253ef.yaml] using context class loader
ParallelWebappClassLoader
>  context: webApp
>  delegate: false
> ----------> Parent Classloader:
> java.net.URLClassLoader@32d992b2
> .
> TRACE StatusLogger Trying to find [log4j2-test4a253ef.yaml] using ParallelWebappClassLoader
>  context: webApp
>  delegate: false
> ----------> Parent Classloader:
> java.net.URLClassLoader@32d992b2
> class loader.
> TRACE StatusLogger Trying to find [log4j2-test4a253ef.yaml] using ParallelWebappClassLoader
>  context: webApp
>  delegate: false
> ----------> Parent Classloader:
> java.net.URLClassLoader@32d992b2
> class loader.
> TRACE StatusLogger Trying to find [log4j2-test4a253ef.yaml] using ClassLoader.getSystemResource().
> TRACE StatusLogger Trying to find [log4j2-test4a253ef.json] using context class loader
ParallelWebappClassLoader
>  context: webApp
>  delegate: false 
> 
> That
> should get you started so you can try a few things to make
> progress with the issues you’re seeing. 
> 
> (Remko
> 
>> On Apr 30, 2019, at 18:30, Karen Goh
> <karenworld@yahoo.com.invalid>
> wrote:
>> 
>> Thanks
> Remko,
>> I wish everyone think like you,
> on the good side.
>> As I think my problem
> should be very straight forward to this group as I am only a
> noob in programming related staff, I will get a response
> within the time frame like other Apache group. 
>> Anyway, I will wait patiently for a reply
> for now.
>> Thanks for the hel in
> advance.
>> I will be happy to contribute
> to the community in whatever way u can. For example like
> reach out to developing countries to make people more
> computer literate if I learnt the know how in log4j2.
>> 
>> 
>> Sent from Yahoo Mail for iPhone
>> 
>> 
>> On Tuesday, April 30, 2019, 4:38 PM, Remko
> Popma <remko.popma@gmail.com>
> wrote:
>> 
>> Folks,
>> 
>> It’s all good, no
> worries. 
>> Sometimes email comes across
> different than intended, which is why we always assume good
> intentions and try to act in an empathetic fashion (https://www.apache.org/foundation/policies/conduct).
> 
>> 
>> Enjoy! 
>> ;-)
>> 
>> Remko
>> 
>> 
>>> On Apr 30, 2019,
> at 17:29, Karen Goh <karenworld@yahoo.com.invalid>
> wrote:
>>> 
>>> I
> am not sure in what way have I not been polite.
>>> Hope you can point out.
>>> I have asked that question because I
> was afraid my message did not get thru.
>>> 
>>> 
>>> Sent from Yahoo Mail for iPhone
>>> 
>>> 
>>> On Tuesday, April 30, 2019, 3:59 PM,
> Arthur Hsieh <arthur@tth.tw>
> wrote:
>>> 
>>> Hi
> Karen,
>>> 
>>> NO
> ONE is obliged to answer your question, rather, people do so
> out of the kindness and in the spirit of the open source
> community.  Most people who contributes to open source
> projects have days jobs and are kind enough to spend their
> personal time to in assisting others.  Please do not take
> this for granted and may I suggest being more polite in your
> requests for assistance/replies. 
>>> 
> 
>>> 
>>> Kind
> regards,
>>> Arthur
>>> 
>>> On
> 2019/4/30, 10:59, "Karen Goh" <karenworld@yahoo.com.INVALID>
> wrote:
>>> 
>>>  
>    Hi,
>>>      
>>>      I would like to know why am I
> not getting a reply for my question.
>>>      
>>>     
> Anyway, I would like to add that I have now changed to maven
> web app.
>>>      
>>>      And here's my log4j2.xml
> file ;
>>>      
>>>      <?xml version="1.0"
> encoding="UTF-8"?>
>>>  
>    <!DOCTYPE xml>
>>>      
>>>          <Configuration
> status="DEBUG">
>>>     
> 
>>>             
> <Appenders>
>>>            
>      <Console name="LogToConsole"
> target="SYSTEM_OUT">
>>>  
>                    <PatternLayout
>>>                         
> pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} -
> %msg%n" />
>>>            
>      </Console>
>>>        
>      </Appenders>
>>>      
>        <Loggers>
>>>      
>            <!-- avoid duplicated logs with
> additivity=false -->
>>>        
>          <Logger name="business"
> level="debug" additivity="false">
>>>                     
> <AppenderRef ref="LogToConsole" />
>>>                 
> </Logger>
>>>              
>    <Root level="error">
>>>                     
> <AppenderRef ref="LogToConsole" />
>>>                 
> </Root>
>>>             
> </Loggers>
>>>         
> </Configuration>
>>>         
> 
>>>      I also have a
> log4j.properties file which I am not sure if I should remove
> it cos I am not sure should I just use log4j2 will do. 
> Hope someone can advise me.
>>>     
> 
>>>      status = fatal
>>>      name = PropertiesConfig
>>>      
>>>     
> filters = threshold
>>>      
>>>      filter.threshold.type =
> ThresholdFilter
>>>     
> filter.threshold.level = debug
>>>    
> 
>>>      appenders = console
>>>      
>>>     
> appender.console.type = Console
>>>  
>    appender.console.name = STDOUT
>>>      appender.console.layout.type =
> PatternLayout
>>>     
> appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss}
> %-5p %c{1}:%L - %m%n
>>>      
>>>      # Console appender. (this is
> added on 7 Mar 2019)
>>>     
> log4j.appender.console=org.apache.log4j.ConsoleAppender
>>>     
> log4j.appender.console.layout=org.apache.log4j.PatternLayout
>>>     
> log4j.appender.console.layout.ConversionPattern=%d [%t] %-5p
> %c - %m%n
>>>      
>>>      rootLogger.level = fatal
>>>      rootLogger.appenderRefs =
> stdout
>>>     
> rootLogger.appenderRef.stdout.ref = STDOUT
>>>      
>>>     
> # Root logger (this is added on 7 Mar 2019)
>>>      # console will log to console
> (local tomcat) or stdout.log im Tomcat/logs
>>>      log4j.rootLogger=ALL, console
>>>      
>>>     
> 
>>>      # Root logger option 
>>>      log4j.rootLogger=INFO, stdout
>>>      
>>>     
> # 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
>>>    
> 
>>>      # Define the root logger
> with file appender
>>>     
> log4j.rootLogger = fatal, sql
>>>     
> 
>>>      # Define the file
> appender
>>>     
> log4j.appender.sql=org.apache.log4j.jdbc.JDBCAppender
>>>      
>>>     
> #log4j.appender.sql.URL="jdbc:mysql://localhost/hi5project?autoReconnect=true&ampserverTimezone=UTC&ampUseSSL=False";
>>>     
> log4j.appender.sql.URL="jdbc:postgresql://localhost:5432/membership";
>>>      # Set Database Driver
>>>     
> #log4j.appender.sql.driver=com.mysql.cj.jdbc.Driver
>>>     
> log4j.appender.sql.driver="org.postgresql.Driver";
>>>      # Set database user name and
> password
>>>     
> #log4j.appender.sql.user=root
>>>     
> log4j.appender.sql.user=postgres
>>>  
>    
>>>     
> #log4j.appender.sql.password=password
>>>     
> log4j.appender.sql.password=travel8
>>>      # Set the SQL statement to be
> executed.
>>>      # Define the xml
> layout for file appender
>>>     
> log4j.appender.sql.layout=org.apache.log4j.PatternLayout
>>>      
>>>     
> 
>>>     
> log4j.additivity.jdbc.sqlonly=false
>>>     
> log4j.additivity.jdbc.sqltiming=false
>>>     
> log4j.additivity.jdbc.audidt=false
>>>     
> log4j.additivity.jdbc.resultset=false
>>>     
> log4j.additivity.jdbc.connection=false
>>>     
> log4j.additivity.jdbc.resultsettable=false
>>>      
>>>     
> ! the appender used for the JDBC API layer call logging
> above, sql only
>>>      
>>>      <configuration>
>>>          <appender
> name="CONSOLE"
> class="MySQLConstants.class.ConsoleAppender">
>>>              <encoder>
>>>                 
> <pattern>%d{yyyy-MM-dd
> HH:mm:ss}|${HOSTNAME}|%contextName|%-5level|%msg
> ||%class:%line %n</pattern>
>>>  
>            </encoder>
>>>  
>        </appender>
>>>      
>    <!-- the console defaults to INFO level-->
>>>          <root
> level="INFO">
>>>      
>        <appender-ref ref="CONSOLE"/>
>>>          </root>
>>>      </configuration>
>>>      
>>>     
> com.sun.mail.smtp.SMTPTransport.level = CONFIG
>>>      com.sun.mail.smtp.level =
> CONFIG
>>>      com.sun.mail.level =
> CONFIG
>>>     
> com.sun.mail.util.MailLogger.level = CONFIG
>>>      javax.mail.Session.level =
> CONFIG
>>>      javax.mail.level =
> CONFIG
>>>      
>>>      
>>>     
> Besides that, I also have added into my tomcat logging
> properties file the below lines:
>>>  
>    
>>>     
> com.sun.mail.smtp.SMTPTransport.level = CONFIG
>>>      com.sun.mail.smtp.level =
> CONFIG
>>>      com.sun.mail.level =
> CONFIG
>>>     
> com.sun.mail.util.MailLogger.level = CONFIG
>>>      javax.mail.Session.level =
> CONFIG
>>>      javax.mail.level =
> CONFIG
>>>      
>>>      And in my javamail;
>>>      
>>>     
> public class sendMail() {
>>>      
>>>      private static final
> org.apache.logging.log4j.Logger logger =
> org.apache.logging.log4j.LogManager
>>>                 
> .getLogger(sendMail.class);
>>>      
>    private Connection conn;
>>>    
>      private PreparedStatement ps = null;
>>>      
>>>     
> public void sendEmail(String strEmail) throws
> MessagingException {
>>>          
>    init();
>>>      
>>>              strEmail =
> findEmail();
>>>           
> System.out.println("Email of registered tutor : "
> + strEmail);
>>>              try
> {
>>>                  Message
> message = new MimeMessage(session);
>>>                 
> message.setFrom(new InternetAddress("xxx@gmail.com"));
>>>                 
> message.addRecipient(Message.RecipientType.TO, new
> InternetAddress(strEmail));
>>>      
>            logger.debug(findEmail());
>>>                 
> logger.info("Sending verify email to {} for {}",
> findEmail());
>>>              
>    message.setSubject("Thank you for registering with
> us");
>>>                 
> message.setContent("You have successfully
> registered", "text/html; charset=utf-8");
>>>                  // Send
> message
>>>                 
> Transport.send(message);
>>>        
>          System.out.println("Mail successfully
> sent");
>>>                
>  } catch (MessagingException mex) {
>>>              
>>>                  }
>>>          }
>>>      }
>>>     
> 
>>>      Please. I hope someone can
> help me on this.
>>>      
>>>      
>>>     
> 
>>>      
>>>  
>    --- On Wed, 4/17/19, Karen Goh <karenworld@yahoo.com>
> wrote:
>>>      
>>>      > From: Karen Goh <karenworld@yahoo.com>
>>>      > Subject: Not able to get
> logging printout to console, email etc
>>>      > To: log4j-user@logging.apache.org
>>>      > Date: Wednesday, April 17,
> 2019, 1:44 PM
>>>      > 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
>>>      
>>>     
> 
>>> 
>>> 
> B�KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKCB��[��X��ܚX�KK[XZ[����]\�\�][��X��ܚX�P���[�˘\X�K�ܙ�B��܈Y][ۘ[��[X[��K[XZ[����]\�\�Z[���[�˘\X�K�ܙ�B�
>>> 
>>> 
>> 
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 



---------------------------------------------------------------------
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