JDBC appender not working

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

JDBC appender not working

Michael Carman
I'm having an odd problem and don't know where to look for troubleshooting
purposes.

I have an Eclipse RCP application. I'm attempting to transition logging
from a file to a database (Oracle). When running my application via Eclipse
events are logged to the database as expected. When running my application
directly (i.e. after building) no log events appear in the database. I'm
not seeing any (relevant) errors in either my application log or the
Eclipse log. (My Log4j configuration has both file and database appenders
defined.) I know that my connection to the database is working because
other portions of my application make stored procedure calls and they're
working.

My first thought is that Log4j isn't committing after inserting new data.
LOG4J2-438 <https://issues.apache.org/jira/browse/LOG4J2-438> appears to be
about that exact issue, but it's marked as being fixed in 2.0-rc1; I'm
running 2.7. Besides, that wouldn't explain why it works when running under
Eclipse.

Does anyone have any ideas about what might be wrong?

-Mike
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: JDBC appender not working

Gary Gregory-4
It feels like your Log4j configuration is not being used. I would:

- Use the latest version 2.8.2
- Turn on Log4j debugging in both your config file with status="DEBUG" and
also on the command line with "-Dlog4j.debug=true" (but I think this last
one might only work in 2.9-SNAPSHOT)

Gary

On Wed, Aug 9, 2017 at 12:16 PM, Michael Carman <[hidden email]>
wrote:

> I'm having an odd problem and don't know where to look for troubleshooting
> purposes.
>
> I have an Eclipse RCP application. I'm attempting to transition logging
> from a file to a database (Oracle). When running my application via Eclipse
> events are logged to the database as expected. When running my application
> directly (i.e. after building) no log events appear in the database. I'm
> not seeing any (relevant) errors in either my application log or the
> Eclipse log. (My Log4j configuration has both file and database appenders
> defined.) I know that my connection to the database is working because
> other portions of my application make stored procedure calls and they're
> working.
>
> My first thought is that Log4j isn't committing after inserting new data.
> LOG4J2-438 <https://issues.apache.org/jira/browse/LOG4J2-438> appears to
> be
> about that exact issue, but it's marked as being fixed in 2.0-rc1; I'm
> running 2.7. Besides, that wouldn't explain why it works when running under
> Eclipse.
>
> Does anyone have any ideas about what might be wrong?
>
> -Mike
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: JDBC appender not working

Michael Carman
My configuration is definitely being used -- I have two appender references
(RollingFile and JDBC) under the root logger and events are being written
to the file appender.

Unfortunately, setting status="debug" had no effect. That might be because
log4j sends those messages to the console and there isn't one for my (GUI)
application. Apparently console != stdout here, because my app intercepts
data written to stdout/stderr and sends a copy to a logger but nothing is
showing up in my file. Is there a logger name for which I can set the
logging level instead?

Setting -Dlog4j.debug doesn't appear to have any effect either. :(

On Wed, Aug 9, 2017 at 3:06 PM Gary Gregory <[hidden email]> wrote:

> It feels like your Log4j configuration is not being used. I would:
>
> - Use the latest version 2.8.2
> - Turn on Log4j debugging in both your config file with status="DEBUG" and
> also on the command line with "-Dlog4j.debug=true" (but I think this last
> one might only work in 2.9-SNAPSHOT)
>
> Gary
>
> On Wed, Aug 9, 2017 at 12:16 PM, Michael Carman <
> [hidden email]>
> wrote:
>
> > I'm having an odd problem and don't know where to look for
> troubleshooting
> > purposes.
> >
> > I have an Eclipse RCP application. I'm attempting to transition logging
> > from a file to a database (Oracle). When running my application via
> Eclipse
> > events are logged to the database as expected. When running my
> application
> > directly (i.e. after building) no log events appear in the database. I'm
> > not seeing any (relevant) errors in either my application log or the
> > Eclipse log. (My Log4j configuration has both file and database appenders
> > defined.) I know that my connection to the database is working because
> > other portions of my application make stored procedure calls and they're
> > working.
> >
> > My first thought is that Log4j isn't committing after inserting new data.
> > LOG4J2-438 <https://issues.apache.org/jira/browse/LOG4J2-438> appears to
> > be
> > about that exact issue, but it's marked as being fixed in 2.0-rc1; I'm
> > running 2.7. Besides, that wouldn't explain why it works when running
> under
> > Eclipse.
> >
> > Does anyone have any ideas about what might be wrong?
> >
> > -Mike
> >
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: JDBC appender not working

Gary Gregory-4
This might help:
https://logging.apache.org/log4j/2.x/manual/configuration.html#StatusMessages

Gary

On Wed, Aug 9, 2017 at 1:56 PM, Michael Carman <[hidden email]>
wrote:

> My configuration is definitely being used -- I have two appender references
> (RollingFile and JDBC) under the root logger and events are being written
> to the file appender.
>
> Unfortunately, setting status="debug" had no effect. That might be because
> log4j sends those messages to the console and there isn't one for my (GUI)
> application. Apparently console != stdout here, because my app intercepts
> data written to stdout/stderr and sends a copy to a logger but nothing is
> showing up in my file. Is there a logger name for which I can set the
> logging level instead?
>
> Setting -Dlog4j.debug doesn't appear to have any effect either. :(
>
> On Wed, Aug 9, 2017 at 3:06 PM Gary Gregory <[hidden email]>
> wrote:
>
> > It feels like your Log4j configuration is not being used. I would:
> >
> > - Use the latest version 2.8.2
> > - Turn on Log4j debugging in both your config file with status="DEBUG"
> and
> > also on the command line with "-Dlog4j.debug=true" (but I think this last
> > one might only work in 2.9-SNAPSHOT)
> >
> > Gary
> >
> > On Wed, Aug 9, 2017 at 12:16 PM, Michael Carman <
> > [hidden email]>
> > wrote:
> >
> > > I'm having an odd problem and don't know where to look for
> > troubleshooting
> > > purposes.
> > >
> > > I have an Eclipse RCP application. I'm attempting to transition logging
> > > from a file to a database (Oracle). When running my application via
> > Eclipse
> > > events are logged to the database as expected. When running my
> > application
> > > directly (i.e. after building) no log events appear in the database.
> I'm
> > > not seeing any (relevant) errors in either my application log or the
> > > Eclipse log. (My Log4j configuration has both file and database
> appenders
> > > defined.) I know that my connection to the database is working because
> > > other portions of my application make stored procedure calls and
> they're
> > > working.
> > >
> > > My first thought is that Log4j isn't committing after inserting new
> data.
> > > LOG4J2-438 <https://issues.apache.org/jira/browse/LOG4J2-438> appears
> to
> > > be
> > > about that exact issue, but it's marked as being fixed in 2.0-rc1; I'm
> > > running 2.7. Besides, that wouldn't explain why it works when running
> > under
> > > Eclipse.
> > >
> > > Does anyone have any ideas about what might be wrong?
> > >
> > > -Mike
> > >
> >
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: JDBC appender not working

Michael Carman
In reply to this post by Michael Carman
After adding dest=<file> to my configuration I can see the status messages
from log4j. I'm getting a ClassNotFoundException when it tries to load my
connection factory. I've seen these sorts of shenanigans from Eclipse
before. (i.e. classes being found when running under Eclipse that aren't
when running a build) That said, I thought I had everything configured in a
way that would work. I can't very well inject an import into the log4j
*.jar, so how does one define a connection factory in a way that log4j can
find it?

On Wed, Aug 9, 2017 at 3:56 PM Michael Carman <[hidden email]>
wrote:

> My configuration is definitely being used -- I have two appender
> references (RollingFile and JDBC) under the root logger and events are
> being written to the file appender.
>
> Unfortunately, setting status="debug" had no effect. That might be because
> log4j sends those messages to the console and there isn't one for my (GUI)
> application. Apparently console != stdout here, because my app intercepts
> data written to stdout/stderr and sends a copy to a logger but nothing is
> showing up in my file. Is there a logger name for which I can set the
> logging level instead?
>
> Setting -Dlog4j.debug doesn't appear to have any effect either. :(
>
> On Wed, Aug 9, 2017 at 3:06 PM Gary Gregory <[hidden email]>
> wrote:
>
>> It feels like your Log4j configuration is not being used. I would:
>>
>> - Use the latest version 2.8.2
>> - Turn on Log4j debugging in both your config file with status="DEBUG" and
>> also on the command line with "-Dlog4j.debug=true" (but I think this last
>> one might only work in 2.9-SNAPSHOT)
>>
>> Gary
>>
>> On Wed, Aug 9, 2017 at 12:16 PM, Michael Carman <
>> [hidden email]>
>> wrote:
>>
>> > I'm having an odd problem and don't know where to look for
>> troubleshooting
>> > purposes.
>> >
>> > I have an Eclipse RCP application. I'm attempting to transition logging
>> > from a file to a database (Oracle). When running my application via
>> Eclipse
>> > events are logged to the database as expected. When running my
>> application
>> > directly (i.e. after building) no log events appear in the database. I'm
>> > not seeing any (relevant) errors in either my application log or the
>> > Eclipse log. (My Log4j configuration has both file and database
>> appenders
>> > defined.) I know that my connection to the database is working because
>> > other portions of my application make stored procedure calls and they're
>> > working.
>> >
>> > My first thought is that Log4j isn't committing after inserting new
>> data.
>> > LOG4J2-438 <https://issues.apache.org/jira/browse/LOG4J2-438> appears
>> to
>> > be
>> > about that exact issue, but it's marked as being fixed in 2.0-rc1; I'm
>> > running 2.7. Besides, that wouldn't explain why it works when running
>> under
>> > Eclipse.
>> >
>> > Does anyone have any ideas about what might be wrong?
>> >
>> > -Mike
>> >
>>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: JDBC appender not working

Ralph Goers
Why can’t the class for the connection factory be included in the class path?

Ralph

> On Aug 9, 2017, at 2:17 PM, Michael Carman <[hidden email]> wrote:
>
> After adding dest=<file> to my configuration I can see the status messages
> from log4j. I'm getting a ClassNotFoundException when it tries to load my
> connection factory. I've seen these sorts of shenanigans from Eclipse
> before. (i.e. classes being found when running under Eclipse that aren't
> when running a build) That said, I thought I had everything configured in a
> way that would work. I can't very well inject an import into the log4j
> *.jar, so how does one define a connection factory in a way that log4j can
> find it?
>
> On Wed, Aug 9, 2017 at 3:56 PM Michael Carman <[hidden email]>
> wrote:
>
>> My configuration is definitely being used -- I have two appender
>> references (RollingFile and JDBC) under the root logger and events are
>> being written to the file appender.
>>
>> Unfortunately, setting status="debug" had no effect. That might be because
>> log4j sends those messages to the console and there isn't one for my (GUI)
>> application. Apparently console != stdout here, because my app intercepts
>> data written to stdout/stderr and sends a copy to a logger but nothing is
>> showing up in my file. Is there a logger name for which I can set the
>> logging level instead?
>>
>> Setting -Dlog4j.debug doesn't appear to have any effect either. :(
>>
>> On Wed, Aug 9, 2017 at 3:06 PM Gary Gregory <[hidden email]>
>> wrote:
>>
>>> It feels like your Log4j configuration is not being used. I would:
>>>
>>> - Use the latest version 2.8.2
>>> - Turn on Log4j debugging in both your config file with status="DEBUG" and
>>> also on the command line with "-Dlog4j.debug=true" (but I think this last
>>> one might only work in 2.9-SNAPSHOT)
>>>
>>> Gary
>>>
>>> On Wed, Aug 9, 2017 at 12:16 PM, Michael Carman <
>>> [hidden email]>
>>> wrote:
>>>
>>>> I'm having an odd problem and don't know where to look for
>>> troubleshooting
>>>> purposes.
>>>>
>>>> I have an Eclipse RCP application. I'm attempting to transition logging
>>>> from a file to a database (Oracle). When running my application via
>>> Eclipse
>>>> events are logged to the database as expected. When running my
>>> application
>>>> directly (i.e. after building) no log events appear in the database. I'm
>>>> not seeing any (relevant) errors in either my application log or the
>>>> Eclipse log. (My Log4j configuration has both file and database
>>> appenders
>>>> defined.) I know that my connection to the database is working because
>>>> other portions of my application make stored procedure calls and they're
>>>> working.
>>>>
>>>> My first thought is that Log4j isn't committing after inserting new
>>> data.
>>>> LOG4J2-438 <https://issues.apache.org/jira/browse/LOG4J2-438> appears
>>> to
>>>> be
>>>> about that exact issue, but it's marked as being fixed in 2.0-rc1; I'm
>>>> running 2.7. Besides, that wouldn't explain why it works when running
>>> under
>>>> Eclipse.
>>>>
>>>> Does anyone have any ideas about what might be wrong?
>>>>
>>>> -Mike
>>>>
>>>
>>



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Loading...