Reputation: 681
I needed to understand the design pattern(s) used in log4j library. Since it provides loggers for various classes, it it a factory ?
Any more inputs/pointers on these is greatly appreciated..
Upvotes: 3
Views: 4371
Reputation: 705
It is using a mixture of design pattern, is using Singleton and Chain of responsibilities patterns.
I've checked on a e-learning website.
Upvotes: 1
Reputation: 39
Log4j uses singleton design pattern, as it will have single instance of class. check this for reference http://www.oodesign.com/singleton-pattern.html
Upvotes: 3
Reputation: 351
Log4j is Singleton Pattern which comes under Creational design pattern
Upvotes: 1
Reputation: 87
Which kind of designpattern do you mean? Creational, behavioral or structural?
If you mean creational, I´d agree with the factory-pattern, but when you want to be sure, you could ask Ceki Gülcü ([email protected], [email protected] or through his profile), the designer of log4j, who could and would answer this question.
Upvotes: 1