You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by pa...@firstenergycorp.com on 2004/06/15 12:48:24 UTC

Logging to Oracle -- still looking for help

Hello again,

I'm still looking for any assistance I can get with this problem. Wasn't
sure if the lack of response was due to the fact that nobody else has done
this or something that I did in my post (too much information in post?  Not
formatted right?)

If there is ANYTHING else I can provide please let me know. I'd really like
to figure out how to get this to work. There doesn't seem to be any other
resources besides this mailing list when it comes to log4net. If there are
I'd really appreciate it if anyone could point me to them.

Thanks in advance!

David

--------------    original message ---------------

Hello,

I getting stuck trying to get this Oracle logging example to work ... (
http://log4net.sourceforge.net/release/1.2.0.30507/doc/manual/example-config-appender.html
)  We don't have Oracle 9. The only thing I thought I had to do was to
eliminate the Datetime column because our version of Oracle doesn't have a
datatype of timestamp.

So my table is defined as follows:

CREATE TABLE CSAX30.LOG
(
      THREAD      VARCHAR2(255),
      LOG_LEVEL   VARCHAR2(255),
      LOGGER      VARCHAR2(255),
      MESSAGE     VARCHAR2(4000)
)
TABLESPACE CSAX30D LOGGING

The Web.config file section for this appender looks like this:

      <appender name="ADONetAppender_Oracle" type
="log4net.Appender.ADONetAppender" >
            <param name="ConnectionType" value
="System.Data.OracleClient.OracleConnection, System.Data.OracleClient,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
            <param name="ConnectionString" value="data source=oragen1d;User
ID=csax30;Password=oragen1d" />
            <param name="CommandText" value="INSERT INTO Log
(Thread,Log_Level,Logger,Message) VALUES (:log_date, :thread, :log_level,
:logger, :message)" />
            <param name="BufferSize" value="128" />
            <param name="Parameter">
                  <param name="ParameterName" value=":thread" />
                  <param name="DbType" value="String" />
                  <param name="Size" value="255" />
                  <param name="Layout" type="log4net.Layout.PatternLayout">
                        <param name="ConversionPattern" value="%t" />
                  </param>
            </param>
            <param name="Parameter">
                  <param name="ParameterName" value=":log_level" />
                  <param name="DbType" value="String" />
                  <param name="Size" value="50" />
                  <param name="Layout" type="log4net.Layout.PatternLayout">
                        <param name="ConversionPattern" value="%p" />
                  </param>
            </param>
            <param name="Parameter">
                  <param name="ParameterName" value=":logger" />
                  <param name="DbType" value="String" />
                  <param name="Size" value="255" />
                  <param name="Layout" type="log4net.Layout.PatternLayout">
                        <param name="ConversionPattern" value="%c" />
                  </param>
            </param>
            <param name="Parameter">
                  <param name="ParameterName" value=":message" />
                  <param name="DbType" value="String" />
                  <param name="Size" value="4000" />
                  <param name="Layout" type="log4net.Layout.PatternLayout">
                        <param name="ConversionPattern" value="%m" />
                  </param>
            </param>
      </appender>

And in my code I do this...
          Private Shared ReadOnly oraclelog As ILog =
LogManager.GetLogger("ADONetAppender_Oracle")
           ...
          If oraclelog.IsDebugEnabled Then oraclelog.Debug("oracle
message")


I've stepped thru the code in debugger and the "oraclelog.IsDebugEnabled"
method returns True. I've enclosed the above statement in a try/catch
thinking that maybe there was an error but there was none.

I'm sure I'm missing something very simple but I can't figure out what.

Has anyone been successful in logging to Oracle? If so, can you tell what
I'm doing wrong?

Thanks in advance for any help.

David.




-----------------------------------------
The information contained in this message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately, and delete the original message.