log4net - At what stage do you add logging & tracing in OO? -
What level of interest am I developing, logging and / or tracing in my applications?
I am working with Net Stock and Log 4 Net (via commons.logging). Generally taking a TDD approach for development, although not 100% of course, sometimes I know that the test coverage my application sits on all server-side, e.g. Web services, Windows services that consume messages from a bus, ASP.NM MCC Business Admin Apps e.t.c.
I found ways to decorate with descriptive logger in my applicatiosn services. Receiving cake from the "INFO" repository "Some work .." 5 cakes were found from the repository. ", And then an uncontrolled accention handler for negligence of app Kamin. The gates that bubble up for the unexpected expectations.
However, I usually go back and stop applying it, rather than the beginning of development, near the end of development and I can have only a dozen or two, I think I should To reduce the color of any lower class or class like locker material, it seems meaningless to implement ICCRPository.
For tracing, which is triggered by config, I should take care of the method call and example construction, the IOC framework, and trouble on the site rather than the heavy trouble population.
My software is in layers, with a well-defined API between each level. From the beginning, I implement the logging for those APIs, so that for a given transaction I can see how the result is displayed in each API call in the underlying layers: If there is a mistake, then it will have a specific layer. Logging will also help to reproduce a problem by showing the log of all the previous, normal activity leading to the problem.
I can also add logic within each layer where I can say, and login failure log in.
A log file therefore usually shows the sequence of calls to the public API, with the error message generated from inside: it is often enough to diagnose the problem.
In addition, I add debug-level logging to an essential-required basis: Debugging specific problems during development and / or during the release.
My argument to take care of logging is partly explained in the following:
To fix any bugs in the software released, I depend on the log file; And it is also often in the form of software as it is being developed.
You said,
I think that I rarely decorate any lower level classes like logarithmic items such as the IKE repository Sounds useless
I said,
My software is in layers with a well-defined API between each layer, from the beginning to logging for those APIs I am implementing ... I think I will tell it better that what "layers" means, for example, my system may have the following layers:
/ P>
- UI
- Business Layer (Rules for Manipulating Data)
- Data One In that case, I will have the following interface or API, which is probably worth logging:
- Databases
- Ul>
- between user and UI (i.e. UI events, mouse and keyboard)
- Between UI and Business Layer ("Humble Dialog Box"
- Business Layer and DAL
Alternatively between the DAL and the database
Alternatively the system can have a series of components connecting two parts In any case, what I am logging in is the API that is the public mask of each component, Good for entering a variety of reasons:
- Not very complicated (Mask is simpler than built-in / internal implementation)
- Good coverage (if I complete The mask, and if the only way in component is through your mask , I know that I have logged each component into component)
- Works well with it: When debugging system with multiple components, recurring a separate team, developed by each One of the questions is, "Which component is fault, and therefore which team is to debug it?"
Comments
Post a Comment