I am starting to develop a new ASP.NET application for subsonic3 (for questions) and log4net (logs) of
) And log4net to understand how to interface subsonic3 so that log4net could log the built-in SQL using subsonic.
This is what I have done so far:
Public stable IEnumerable & lt; Arma_ocorrencium & gt; ListArmasOcorrencia () {if (logger.IsInfoEnabled) {logger.Info ("ListarArmasOcorrencia: start"); } Var db = new BDVDDB (); Select db.arma_ocorrencia p in Var select = from p; Var Results = Select Toolist & lt; Arma_ocorrencium & gt; (); // execute the query here (logger.IsInfoEnabled) {// log sql here} if (logger.IsInfoEnabled) {logger.Info ("ListarArmasOcorrencia: end"); } Return results; }
You can use the log property of the provider category: _db.Provider.Log = Console.Out;
will log your SQL statement in the console if you want to use log4net or something similar, then you have to write a small intermediate class that implements TextWriter and redirect all received input to log4net is.
Comments
Post a Comment