logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oswaldo Caballero <osw...@gmail.com>
Subject Re: Log4j2 databaseAppender does not write to the database. It was working before!
Date Sat, 07 Dec 2013 14:55:20 GMT
Well, it's working again!  I don't think it has a direct relation, but what I did was to truncate
the MySQL table it was using to write the log to. After that, the logger began to write to
the database as before. May be the table was corrupted? Because it's not a question of disk
space, the database server has plenty of free space on it.  Anyway, it's working again and
I hope the problem will not return.

Finally, I want just to thank the apache log4j team for a great work and to thank you for
your valuable help.

Best regards,

Oswaldo


On 2013-12-06, at 11:56 AM, Gary Gregory wrote:

> On Fri, Dec 6, 2013 at 11:35 AM, Oswaldo Caballero <oswcab@gmail.com> wrote:
> 
>> On 13-12-06 11:08 AM, Gary Gregory wrote:
>> 
>>> Please take a look at the change log:
>>> https://logging.apache.org/log4j/2.x/changes-report.html#a1.0-alpha1
>>> 
>>> Specifically, note:Renamed FastFileAppender and FastRollingFileAppender to
>>> RandomAccessFileAppender and RollingRandomAccessFileAppender.
>>> Configurations using the Fast(Rolling)File element no longer work and
>>> should be modified to use the (Rolling)RandomAccessFile element. Fixes
>>> LOG4J2-317 <http://issues.apache.org/jira/browse/LOG4J2-317>.
>>> 
>>> 
>>> Gary
>>> 
>>> 
>>> On Fri, Dec 6, 2013 at 11:01 AM, Oswaldo Caballero <oswcab@gmail.com>
>>> wrote:
>>> 
>>> On 13-12-06 10:51 AM, Gary Gregory wrote:
>>>> 
>>>> Can you try with the current version please, beta 9?
>>>>> 
>>>>> Gary
>>>>> 
>>>>> 
>>>>> On Fri, Dec 6, 2013 at 10:45 AM, Oswaldo Caballero <oswcab@gmail.com>
>>>>> wrote:
>>>>> 
>>>>>  Hi,
>>>>> 
>>>>>> First of all, sorry if I'm posting to the wrong list. If that's the
>>>>>> case,
>>>>>> I'll be grateful if someone redirects me to the correct list.
>>>>>> 
>>>>>> Well, my problem is with the databaseAppender in log4j2 beta 8. It
was
>>>>>> working OK two weeks ago but now it does not write to the log table.
I
>>>>>> must
>>>>>> say that I'm using a pretty standard XML configuration file where
I
>>>>>> have
>>>>>> a
>>>>>>   FastRollingFile (which works perfectly)  and the databaseAppender.
>>>>>> The
>>>>>> file looks like this:
>>>>>> 
>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>> <configuration status="trace">
>>>>>>      <appenders>
>>>>>>          <Console name="Console" target="SYSTEM_OUT">
>>>>>>              <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level
>>>>>> %logger{36} - %msg%n"/>
>>>>>>          </Console>
>>>>>>          <FastRollingFile name="FastRollingFile"
>>>>>> fileName="/home/oswcab/
>>>>>> workspace/harvester/logs/harvester.log"
>>>>>> filePattern="logs/$${date:yyyy-MM}/harvester-%d{yyyy-MM-
>>>>>> dd}-%i.log.gz">
>>>>>>              <PatternLayout pattern="%d [%t] %-5level %logger{36}
- %L
>>>>>> %M -
>>>>>> %msg%n"/>
>>>>>>              <Policies>
>>>>>>                  <TimeBasedTriggeringPolicy/>
>>>>>>                  <SizeBasedTriggeringPolicy size="50 MB"/>
>>>>>>              </Policies>
>>>>>>              <DefaultRolloverStrategy max="20"/>
>>>>>>          </FastRollingFile>
>>>>>>          <JDBC name="databaseAppender" tableName="harvester.logs">
>>>>>>              <ConnectionFactory class="ca.umontreal.cenr.
>>>>>> quinoa.harvester.DataConnection"
>>>>>> method="getConnection"/>
>>>>>>              <Column name="Date" isEventTimestamp="true"/>
>>>>>>              <Column name="Level" pattern="%level"/>
>>>>>>              <Column name="Logger" pattern="%logger"/>
>>>>>>              <Column name="Description" pattern="%message"/>
>>>>>>              <Column name="Exception" pattern="%ex{full}"/>
>>>>>>          </JDBC>
>>>>>>      </appenders>
>>>>>>      <loggers>
>>>>>>          <logger name="ca.umontreal.cenr.quinoa.harvester"
>>>>>> level="trace">
>>>>>>              <appender-ref ref="FastRollingFile"/>
>>>>>>          </logger>
>>>>>>          <root level="trace">
>>>>>>              <appender-ref ref="databaseAppender"/>
>>>>>>          </root>
>>>>>>      </loggers>
>>>>>> </configuration>
>>>>>> 
>>>>>> The log4j2 logger does not report any error and the databaseAppender
is
>>>>>> correctly initialized.
>>>>>> 
>>>>>> I've read many times the Configuration and Appenders sections on
the
>>>>>> online guide and I've tried to change the way the database connection
>>>>>> is
>>>>>> obtained by replacing the <ConnectionFactory> tag with a
>>>>>> <DriverManager>
>>>>>> tag:
>>>>>> 
>>>>>> <DriverManager url="jdbc:mysql://localhost:3306/harvester"
>>>>>> username="root" password="***" />
>>>>>> 
>>>>>> without success.
>>>>>> 
>>>>>> I've also interchanged the assigned appender on the loggers section:
>>>>>> 
>>>>>> <loggers>
>>>>>>          <logger name="ca.umontreal.cenr.quinoa.harvester"
>>>>>> level="trace">
>>>>>>              <appender-ref ref="databaseAppender"/>
>>>>>>          </logger>
>>>>>>          <root level="trace">
>>>>>>              <appender-ref ref="FastRollingFile"/>
>>>>>>          </root>
>>>>>>   </loggers>
>>>>>> 
>>>>>> and the FastRollingFile appender continues to work without a problem,
>>>>>> but
>>>>>> the databaseAppender do not.
>>>>>> 
>>>>>> I must say finally that the application writes to the database without
>>>>>> problems and that the database configuration has not being modified
in
>>>>>> any
>>>>>> way.
>>>>>> 
>>>>>> May be I'm overlooking something obvious but right now I do not know
>>>>>> what's wrong.
>>>>>> 
>>>>>> Thanks and sorry for the long post.
>>>>>> 
>>>>>> Best regards,
>>>>>> 
>>>>>> Oswaldo
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>>>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>>   Thanks for your (very) quickly answer. I've changed to beta 9 as
>>>>> 
>>>> suggested, but now I receive an error:
>>>> 
>>>>          ERROR Error processing element FastRollingFile: CLASS_NOT_FOUND
>>>> 
>>>>         ERROR Unable to locate appender FastRollingFile for logger
>>>> ca.umontreal.cenr.quinoa.harvester
>>>> 
>>>> The jdbcAppender is initialized correctly as before but nothing is
>>>> written
>>>> to the database.:
>>>> 
>>>>        DEBUG Starting JDBCDatabaseManager jdbcManager{
>>>> description=databaseAppender, ...
>>>> 
>>>> finally, a new message that I have not seen before appears in the logs:
>>>> 
>>>>     DEBUG ServletContext not present - WebLookup not added
>>>> 
>>>> 
>>>> Thank you,
>>>> 
>>>> 
>>>> Oswaldo
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>> 
>>>> 
>>>> 
>>> 
>> OK, the RollingRandomAccessFile (long but very descriptive name) works
>> again, but the jdbcAppender do not. I think I'll recheck everything one
>> more time to see if something is wrong with my configuration.
>> 
> 
> We need to figure out where the problem is, hopefully this is something
> that can fixed in the Log4J configuration or perhaps on the database side,
> otherwise, we'll have to figure out what is wrong.
> 
> Gary
> 
>> 
>> If I cannot make it work again, is there any alternative? I mean, I use
>> the  jdbcAppender because my application is installed on a secured server
>> (admins have not direct access to the log file) and its graphic interface
>> is installed on a different one. So, the best way for us to show what's
>> happening with the application is to read the log from the database to
>> display it on the GUI.
>> 
>> Thank you for your help,
>> 
>> 
>> Oswaldo
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>> 
>> 
> 
> 
> -- 
> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> Java Persistence with Hibernate, Second Edition<http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> Spring Batch in Action <http://www.manning.com/templier/>
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory


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