Sybase 資料一覧
重要度の低いエラーをログファイルに出力する方法
2008/7/26更新
対応バージョン: 11.9.2
重要度の低いエラーはデフォルトではログファイルに出力されないが、sp_altermessageを用いて特定のエラー番号をログファイルに出力することができる。
例えばSPを実行しようとしてそのSPが存在しない場合、以下のエラーが出る。
1> foo 2> go Msg 2812, Level 16, State 5: Line 1: Stored procedure 'foo' not found. Specify owner.objectname or use sp_help to check whether the object exists (sp_help may produce lots of output).
これをログファイルに出力させるには以下のようにする。
1> use master 2> go 1> sp_altermessage 2812,"with_log","true" 2> go Message altered.
この設定はsysmessagesテーブルに格納された各エラー番号毎のデバッグレベル(dlevel)として扱われる。
1> select error,dlevel,description from sysmessages 2> where error = 2812 3> go error dlevel description ----- ------ ------------------------------------ 2812 130 Stored procedure '%.*s' not found...
with_logオプションによるデバッグレベルには以下の2種類がある。
130
ログ出力(true)
2
ログ未出力(false)
関連資料・記事