Tag Info

New answers tagged

0

Instead of thinking of logging (i.e. your application telling some logging system, perhaps using syslog(3) on Linux, what is going on) you might think of it differently: your application could be a server for requests querying its state. Then you might even make your app some JSONRPC server (and you'll have also to code the tiny command-line client to ...


7

You are correct that all of these solutions dirty your code with logging / reporting code that breaks separation of concerns. This sort of problem is exactly why Aspect Oriented Programming exists: Wikipedia (emphasis mine): Aspect-oriented programming entails breaking down program logic into distinct parts (so-called concerns, cohesive areas of ...


4

I usually do this by letting every long-running class implement an interface, e.g. LongRunning, with a single method reportProgress(). Your logging service would simply be notified of the existence of such long runners, periodically query their status, and then report on the general state of the world in whatever way it sees fit. Your business code still ...



Top 50 recent answers are included