2
votes

Does anyone know if there is something similar to log4 available for cache?

I've used log4net on a number of .Net projects and would like to have something with the same capabilities. In particular the logging level and the configuration ability between local,dev,qa,and prod environments.

1
logging and caching are two different things right? You want to log inside caching function or what? - Shiham
@nvrtheless - "Cache" refers to the Intersystem's database product in this case. This wouldn't be clear unless you noticed the tag, and perhaps not even then. - psr
oh.. thanks. I did not noticed it. - Shiham

1 Answers

2
votes

It's hard to answer definitively that something doesn't exist, but I'm pretty sure it doesn't exist. The only sources I've been able to find for Cache libraries is either Intersystems, of course, or the M/Gateway website (I am not affiliated with the M/Gateway product or website, nor am I endorsing it, it's just the only Cache code repository I've been able to find. It requires registration and has under 50 files, many of them tutorials).

Searching GitHub for "Intersystems" does find some stuff, but "Intersystems logging", though there are some results in the search, none appear to be anything like log4net.

The base Intersystems libraries include things like ^%ETN, which traps and logs error data, but it just puts some specific stuff in globals, it's nothing like log4net.

So, in summary, I wouldn't hold my breath.

You might consider using log4net a basis for rolling your own simplified version. A Cache way to implement it might be to inherit from a logging class to get the Log method. You could get class specific data either by run-time reflection or by having the Log base class include a generator method to fetch the class specific data (more efficient). In Cache a configuration file probably isn't that useful, so I would suggest persistent configuration classes. I would have design it to allow multiple configurations to be saved to disk at once, and some method of designating one as active.