java


slf4j not working on Websphere but java.util.Logging does


I've setup a very simple log project which logs using both java.util.Logging and slf4j. The java.util.logging works fine but slf4j fails.
This is my setup:
log4j.properties:
# Root logger option
log4j.rootLogger=INFO, stdout, file
# 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} %-5p %c{1}:%L - %m%n
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=/XXX/log4j.log
log4j.appender.file.MaxFileSize=10MB
log4j.appender.file.MaxBackupIndex=10
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
pom.xml snippet:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.5</version>
</dependency>
Sample java code:
import java.util.logging.Logger;
public class LogBean {
Logger log = Logger.getLogger(this.getClass().getName());
org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(this.getClass());
public void log() {
log.info("Pushing to queue");
logger.info("slf4j log");
}
}
This code works fine on JBoss EAP but not on Websphere. The log file does not get created.
Is there anything I'm missing?
Update - changing from log4j to JDK14 works implies the issue is with log4j?

Related Links

Spring Saml secondary certificate in metadata
Can't use Amazon S3 API over SSL?
HQL Delete on object with many to many/one-to-many mappings [duplicate]
request.getRequestDispatcher() failing
optimised algorithm to find maximum value in stack
What design pattern is simple inheritance in Java?
parameters are not passed in jsp
spring Injection of autowired dependencies failed
Backoff Algorithm Simulation
JDBC Huge data for select
Rotating an image with onTouchListener without scaling it
Character returns as 11 instead of B. For loop error [closed]
Dynamically Adding jobs to a running Quartz scheduler from different executable
What is wrong with my insertion sort program and how do I fix it?
Change color of natTable rows based on an RGB value stored in the ModelObject
Mapping a stream of tokens to a stream of n-grams in Java 8

Categories

HOME
osgi
keras
reflection
path-finding
appx
fme
octobercms
at-command
paw-app
sharepoint-designer
dxl
webpack-2
mvvmcross
esper
gnupg
communication
export-to-csv
designer
jsprit
dosgi
ghc
pc
finite-automata
swiftlint
telerik-reporting
wijmo
numerical-methods
primitive
flink-streaming
preg-match-all
jspresso
mapbox-gl
gesture
lumberjack
android-tabhost
angular2-meteor
galleria
dotcover
parentheses
network-flow
zip4j
pango
pnotify
python-webbrowser
datastax-startup
sage-one
statsd
magma
android-cursor
zendesk-app
color-profile
pintos
abcpdf9
savon
pyke
cloudbees
netmq
unity-networking
srand
reactive-banana
iis-arr
jqgrid-formatter
security-testing
sailfish-os
dundas
apache-commons-net
kineticjs
facebook-graph-api-v2.4
gadt
tt-news
google-style-guide
wordpress-theme-customize
websocket4net
preferences
php-5.4
comexception
mysql-error-1062
bundles
resty-gwt
stxxl
cdc
cos
xamlparseexception
ember-app-kit
tinn-r
angularjs-controller
isnullorempty
uiviewanimation-curve
adk
zpt
external-accessory
hirefire
blackberry-playbook
tomcat-valve
winbugs14
locate
jmock
xfbml
revisions
gin
fixed-width
meego
paul-graham

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App