You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "David Roberts (JIRA)" <ji...@apache.org> on 2014/07/09 18:34:05 UTC

[jira] [Created] (LOG4J2-706) InvocationTargetException with RollingFileAppender in Log4J2

David Roberts created LOG4J2-706:
------------------------------------

             Summary: InvocationTargetException with RollingFileAppender in Log4J2
                 Key: LOG4J2-706
                 URL: https://issues.apache.org/jira/browse/LOG4J2-706
             Project: Log4j 2
          Issue Type: Question
          Components: Appenders
    Affects Versions: 2.0-rc2
            Reporter: David Roberts
            Priority: Minor


I'm trying to use a RollingFileAppender in Log4J2 and apparently I'm missing something.  The file is created with 0 bytes, but no logging goes to it.  When I turn on the trace I see the following error message logged (to the console) by log4J2:

    2014-07-08 19:51:11,354 DEBUG Starting RollingFileManager c:/logs/blah.log
    2014-07-08 19:51:11,464 DEBUG Generated plugins in 0.108079890 seconds
    2014-07-08 19:51:11,465 ERROR Unable to invoke method createAppender in class org.apache.logging.log4j.core.appender.RollingFileAppender for element RollingFile java.lang.reflect.InvocationTargetException
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:606)
            at org.apache.logging.log4j.core.config.BaseConfiguration.createPluginObject(BaseConfiguration.java:913)

This is my config file:

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration status="TRACE" verbose="false">
      <appenders>
        <Console name="Console" target="SYSTEM_OUT">
          <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
        </Console>
        <RollingFile name="Blah" fileName="c:/logs/blah.log" filePattern="c:/logs/blah-%i.log">
          <PatternLayout pattern="%d %p %c: %m%n"/>
          <Policies>
            <TimeBasedTriggeringPolicy />
            <SizeBasedTriggeringPolicy size="1 MB"/>
          </Policies>
          <DefaultRolloverStrategy max="10"/>
        </RollingFile>
      </appenders>
      <loggers>
        <root level="INFO">
          <appender-ref ref="Blah" level="INFO"/>
        </root>
      </loggers>
    </configuration>

It's probably something basic but I can't find it.  I posted on stackoverflow and Remko Popma asked me to post a ticket here.

I was getting the problem on rc1, but I have now updated to rc2 and I still see the same issue.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

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