• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

log4j log file name configuration

Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I'm new to log4j and my application(which uses the log4j logging) is a stand alone java client, which gets invoked at scheduled intervals.

The log file specified in my log4j config xml is system.log.

<appender name="sampleFileApp" class="org.apache.log4j.FileAppender">
<param name="File" value="C:/app/logs/system.log"/>
<param name="Append" value="false"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="<%d> <%p> <%c> - <%m>%n"/>

With this configuration, it creates a log file named system.log,
Is there any way to get the log file name as
system + current date/time (in yyyyMMddHHmmss).log instead of just system.log

If you live in a cold climate and on the grid, incandescent light can use less energy than LED. Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!