Re: ClassNotFoundException trying to use JDBC appender

2016-11-29 Thread Michael Carman
To try to tease out whether my problem is at the Eclipse level or the Log4j level I experimented with loading my class via reflection. static { try { Class clazz = Class.forName("x.y.z.LogDB"); Method method = clazz.getMethod("getConnection"); Connection connection = (Connection)

Re: ClassNotFoundException trying to use JDBC appender

2016-11-29 Thread Gary Gregory
OSGi and class loaders make for complications and tricky debugging sessions :-( Gary On Tue, Nov 29, 2016 at 2:08 PM, Michael Carman wrote: > To try to tease out whether my problem is at the Eclipse level or the Log4j > level I experimented with loading my class via

Re: ClassNotFoundException trying to use JDBC appender

2016-11-29 Thread Gary Gregory
Is your getConnection() method static? Gary On Tue, Nov 29, 2016 at 9:04 AM, Michael Carman wrote: > I'm using Log4j2 in an Eclipse RCP application. I've been using a > RollingFileAppender and am trying to switch to a JDBC appender backed by a > ConnectionFactory.

Re: ClassNotFoundException trying to use JDBC appender

2016-11-29 Thread Michael Carman
Yes, getConnection() is static. Log4j isn't getting far enough to attempt calling it, though. An explicit call to LogDB.getConnection() is successful but Log4j's attempts to invoke it via reflection fails trying to load the class. That holds true even if I move my LogDB into the plug-in for my

log4j2 - Logger does not have the configuration If procured before LoggerContext has initialized

2016-11-29 Thread Tarun Sharma
Hi, While upgrading from 1.2.17 to 2.5, I have come across a major difference. Please see following code snippets. Log4j1.2.17 private static final Logger LOGGER = Logger.getLogger(TestLog.class); public static void main(String args[]) { Properties p = new Properties();

Re: FileAppender dynamic fileName

2016-11-29 Thread Remko Popma
To follow up, this worked as expected If system property "proc" is not defined then a file named "unknown.log" is created. This is documented in StrSubstitutor but may be good to emphasize on the lookups manual page. Sent from my iPhone > On 29 Nov 2016, at 10:05, Gary Gregory

Re: Switching log levels at runtime with log4j2

2016-11-29 Thread Gary Gregory
To further muddy the waters, the log4j-1.2-api module includes the classes org.apache.log4j.config.Log4j1* which provide partial support for Log4j 1.2 properties files. Gary On Tue, Nov 29, 2016 at 7:48 AM, Apache wrote: > > > > On Nov 29, 2016, at 8:20 AM, Jochen

Re: ClassNotFoundException trying to use JDBC appender

2016-11-29 Thread Benjamin Jaton
Would that help? http://stackoverflow.com/questions/24179375/eclipse-rcp-java-lang-classnotfoundexception-a-runtime in particular: Bundle-ClassPath: .,lib/library.jar On Tue, Nov 29, 2016 at 4:48 PM, Gary Gregory wrote: > OSGi and class loaders make for complications

Re: Switching log levels at runtime with log4j2

2016-11-29 Thread Apache
> On Nov 29, 2016, at 8:20 AM, Jochen Wiedmann > wrote: > > On Mon, Nov 28, 2016 at 9:58 PM, Gary Gregory wrote: >> Does this help: >> https://garygregory.wordpress.com/2016/01/11/changing-log-levels-in-log4j2/ > > Hi, Gary, > >

Re: Switching log levels at runtime with log4j2

2016-11-29 Thread Jochen Wiedmann
On Mon, Nov 28, 2016 at 9:58 PM, Gary Gregory wrote: > Does this help: > https://garygregory.wordpress.com/2016/01/11/changing-log-levels-in-log4j2/ Hi, Gary, considering what's all in Configurator nowadays, I wonder, whether one could also add a small compatibility

ClassNotFoundException trying to use JDBC appender

2016-11-29 Thread Michael Carman
I'm using Log4j2 in an Eclipse RCP application. I've been using a RollingFileAppender and am trying to switch to a JDBC appender backed by a ConnectionFactory. I've implemented this using the examples at https://logging.apache.org/log4j/2.x/manual/appenders.html#JDBCAppender as a guide but get a