1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ScalikeJDBCでエラーログにsqlを出力しないように制御する

Last updated at Posted at 2018-07-10

利用

  • scala
  • playframework
  • scalikejdbc
  • scalikejdbc-config

はじめに

エラーログにsqlを出してくれるのは便利だが、出ないように制御したいときもある

たとえばログ上に機密性の高い情報を残したくないとか

エラーログ出力例

[error] s.StatementExecutor$$anon$1 - SQL execution failed (Reason: Duplicate entry '123456789' for key 'XXXX_ID'):

   insert into xxxx (XXXX_ID, NAME, UPDATED_BY, UPDATED_AT) values (123456789, 'test', 1, '2018-07-10 02:18:41.988')

ログ出力箇所

エラーログのSQL execution failedを出力しているのは↓

制御箇所

if (settingsProvider.loggingSQLErrors(GlobalSettings.loggingSQLErrors)) 

で制御している

対応方法

application.confに

scalikejdbc.global.loggingSQLErrors=false

を追加してやるとでなくなる

追記

https://github.com/scalikejdbc/scalikejdbc-play-support

scalikejdbc.global.loggingSQLErrors=true載ってますね。

ドキュメントはちゃんと読みましょう。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?