chicout
chicout

Reputation: 937

Log4j Logger and concurrency

Is it okay to have a org.apache.log4j.Logger field in a singleton class? Could be any concurrency issues because of sharing it among multiple threads?

Upvotes: 4

Views: 1558

Answers (2)

Vikdor
Vikdor

Reputation: 24124

No, a Logger object can be used by multiple threads, did you face any issues?

Upvotes: 1

hcarver
hcarver

Reputation: 7214

Nope, there'll be no problems because it's thread-safe (i.e. it won't break if multiple threads are accessing it at the same time).

See http://logging.apache.org/log4j/1.2/faq.html#a1.7

Upvotes: 5

Related Questions