Reply to thread

about logging exceptions vs code cleanliness.

 

http://stackoverflow.com/questions/7046399/inject-logging-dependency-with-castle-windsor

 

just add a attribute to the method u want logged in case of exceptions and avoid the usual code noise with try-catch exceptions.

 

now thats nice :)

 

Another thing is -- at work I'm currently replacing a hardcoded logging impl. with an abstracted impl.

We want to be able to change to any kind of logging framework per app config.

 

I figured the castle windsor (CW) framework had some logging framework abstraction possibilities.

 

and it had :=)

 

<facilities>

 

<!--- log4net logging, see log.config for log4net options -->

<!--

<facility id="loggingfacility"

type="Castle.Facilities.Logging.LoggingFacility, Castle.Facilities.Logging"

loggingApi="log4net"

configFile="log.config"

/>

-->

 

so when I use CW to resolve a registered assembly/class they will get an instance of ILogger injected into its constructor.

 

very neat indeed.

CW has these inbuilt abstractions for the following logging frameworks.

 

loggingApi="null|console|diagnostics|web|nlog|log4net|custom"

 

with the 'custom' one we can create our own logger in the future and replace it real easy like.

 

/gibman


Top Bottom