I'm developing a batch program in java and was looking at different ways to implement error logging.
I will need to output many error msgs in many different objects. At this point I see three different ways of doing this.
1) Create a class that has opening, closing, and writing methods for the file. I would need to initialize a reference in all classes (which is a lot) that need to use this object.
2) Create the file and just have a reference to the File in each class/object.
3) Create a Static Class and use it some what like we use the System.out class. I would have to initialize the class (open the file), and then also close it before the pgm is exited.
Any comments on which is better and why? I'm leaning towards the static class.
Larry
I will need to output many error msgs in many different objects. At this point I see three different ways of doing this.
1) Create a class that has opening, closing, and writing methods for the file. I would need to initialize a reference in all classes (which is a lot) that need to use this object.
2) Create the file and just have a reference to the File in each class/object.
3) Create a Static Class and use it some what like we use the System.out class. I would have to initialize the class (open the file), and then also close it before the pgm is exited.
Any comments on which is better and why? I'm leaning towards the static class.
Larry