How to log subsonic3 sql

Posted by bastos.sergio on Stack Overflow See other posts from Stack Overflow or by bastos.sergio
Published on 2010-05-17T10:17:09Z Indexed on 2010/05/17 10:20 UTC
Read the original article Hit count: 578

Filed under:
|
|
|

Hi, I'm starting to develop a new asp.net application based on subsonic3 (for queries) and log4net (for logs) and would like to know how to interface subsonic3 with log4net so that log4net logs the underlying sql used by subsonic.

This is what I have so far:

public static IEnumerable<arma_ocorrencium> ListArmasOcorrencia()
    {
        if (logger.IsInfoEnabled)
        {
            logger.Info("ListarArmasOcorrencia: start");
        }

        var db = new BdvdDB();
        var select = from p in db.arma_ocorrencia
                              select p;

        var results = select.ToList<arma_ocorrencium>(); //Execute the query here

        if (logger.IsInfoEnabled)
        {
            // log sql here
        }


        if (logger.IsInfoEnabled)
        {
            logger.Info("ListarArmasOcorrencia: end");
        }

        return results;
    }

© Stack Overflow or respective owner

Related posts about subsonic3

Related posts about log4net