log4j


How to Create daily log files in java using Log4J


I have tried to generate daily log files by using DailyRollingFileAppender and here, i have generated single log file But i want to generate the log files based on service name(Ex: AdminService /USERService /ClientService)
Please find attached log4j properties file:
# Root logger option
log4j.rootLogger=ALL, file, stdout
# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} [%t] %-5p:: %m%n
# Direct log messages to a log file
log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
log4j.appender.file.File=app.log
log4j.appender.file.DatePattern='_'yyyy-MM-dd-HH-mm'.log'
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} [%t] %-5p:: %m%n

Related Links

Log4j2 programmatic configuration Log filename issue
Exception logged in Log4j2 log file is in Unix format
log4j2 problems when sending output to a file
Hide log4j logs
Excessive console messages from Kafka Producer
how to resque Log4j output from html tag
log4j2- ERROR Appenders contains an invalid element or attribute “Flume”
Can you use log4j to write logs to secured Kafka with KafkaLog4jAppender
Unable to locate appender
Configurate log4j for external jar
org.jxls seems to affect log4j
In log4j, can the level of a child logger be higher than the root logger's priority value?
Log4cplus: DailyRollingFileAppender rolls the file whenever we close and open the appender again
log4j starts writing bytes of zero value to log file
How to change Flink's log directory
How can I write my properties file if I want to get a log file every hours using log4j?

Categories

HOME
maven
arduino-uno
openlayers
keras
fluentd
comparison
youtube-dl
bookshelf.js
cvs
amazon-ecs
sharepoint-designer
jpeg
google-project-tango
alpha
bs4
dacpac
nano-server
quicklook
handsontable
postgres-xl
google-apps-marketplace
timeout
visual-studio-2005
django-admin
tostring
http-status-code-504
code-review
nhibernate-envers
scichart
object-detection
autoconf
java-3d
java-7
h2db
one-to-many
pepper
procdump
instant-messaging
skia
preg-match
key-value-observing
titanium-mobile
catel
framemaker
openoffice.org
cloud-code
picasso
vxworks
bitbucket-pipelines
android-browser
service-discovery
spring-security-kerberos
estimote
arena-simulation
outlook-api
apple-news
skeleton-css-boilerplate
dotcover
errordocument
hendrix
nstextview
darcs
csound
flutterwave
iso8601
synchronous
mediaelement
background-service
time-and-attendance
angular-cache
grails-tomcat-plugin
httplistener
gstreamer-0.10
ubuntu-10.04
qgraphicsview
hexdump
itextpdf
photobucket
simple-framework
citrus-pay
twirl
sortedlist
angular-local-storage
system.reflection
markers
onactivityresult
uitouch
wp-query
rebol3
yorick
ember-charts
mbr
stxxl
openlaszlo
terminal-services
aqtime
web2py-modules
soundtouch
buster.js
selected
twrequest
chrono
php-parser
window-management
lpeg
google-friend-connect
zend-translate
iweb
uimenucontroller
avatar
3gp

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App