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 <[email protected]> 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 <[email protected]>
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: [email protected]
For additional commands, e-mail: [email protected]
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: [email protected]
For additional commands, e-mail: [email protected]
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.
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: [email protected]
For additional commands, e-mail: [email protected]