{"action":"created","issue":{"url":"https://api.github.com/repos/p6spy/p6spy/issues/299","labels_url":"https://api.github.com/repos/p6spy/p6spy/issues/299/labels{/name}","comments_url":"https://api.github.com/repos/p6spy/p6spy/issues/299/comments","events_url":"https://api.github.com/repos/p6spy/p6spy/issues/299/events","html_url":"https://github.com/p6spy/p6spy/issues/299","id":90602507,"number":299,"title":"Support of reacting differently on SQL-Errors within datasource-proxy","user":{"login":"Heimschmiede","id":13029588,"avatar_url":"https://avatars.githubusercontent.com/u/13029588?v=3","gravatar_id":"","url":"https://api.github.com/users/Heimschmiede","html_url":"https://github.com/Heimschmiede","followers_url":"https://api.github.com/users/Heimschmiede/followers","following_url":"https://api.github.com/users/Heimschmiede/following{/other_user}","gists_url":"https://api.github.com/users/Heimschmiede/gists{/gist_id}","starred_url":"https://api.github.com/users/Heimschmiede/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Heimschmiede/subscriptions","organizations_url":"https://api.github.com/users/Heimschmiede/orgs","repos_url":"https://api.github.com/users/Heimschmiede/repos","events_url":"https://api.github.com/users/Heimschmiede/events{/privacy}","received_events_url":"https://api.github.com/users/Heimschmiede/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-06-24T08:06:10Z","updated_at":"2015-06-27T04:17:38Z","closed_at":null,"body":"#### Enhancement\r\n\r\nIn my UseCase I want to log only the SQLs that fail on the database. Right now (Maven-Version 2.1.4) my custom logger cannot distinguish if the given sql was executed fine or failed.\r\n\r\nIf my logger gets to know if the execution failed it can log the corresponding sql with log-level error. If it worked fine it can use log-level debug.\r\n\r\n#### Related Code\r\n\r\nI am using the `P6DataSource` and the failure can then be detected in `P6LogPreparedStatementExecuteDelegate:50` . The `finally` statement can be replaced by a `catch`-statement. The call to `P6LogQuery` can then be done at the end of the try-block (success-case) and within the catch-block (error-case).\r\n\r\n#### Proposed solutions\r\n\r\n1. Using error-category in case of a failure. But then the logger cannot see errors on rollback-actions for instance.\r\n2. An additional parameter in the `logSQL`-method of the logger that indicates if an error occured\r\n3. A new method in the logger that is called on errors with the effective sql as a parameter. (The currently available method logException is either called never or on all statement-executions)\r\n"},"comment":{"url":"https://api.github.com/repos/p6spy/p6spy/issues/comments/115956201","html_url":"https://github.com/p6spy/p6spy/issues/299#issuecomment-115956201","issue_url":"https://api.github.com/repos/p6spy/p6spy/issues/299","id":115956201,"user":{"login":"quintonm","id":991413,"avatar_url":"https://avatars.githubusercontent.com/u/991413?v=3","gravatar_id":"","url":"https://api.github.com/users/quintonm","html_url":"https://github.com/quintonm","followers_url":"https://api.github.com/users/quintonm/followers","following_url":"https://api.github.com/users/quintonm/following{/other_user}","gists_url":"https://api.github.com/users/quintonm/gists{/gist_id}","starred_url":"https://api.github.com/users/quintonm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quintonm/subscriptions","organizations_url":"https://api.github.com/users/quintonm/orgs","repos_url":"https://api.github.com/users/quintonm/repos","events_url":"https://api.github.com/users/quintonm/events{/privacy}","received_events_url":"https://api.github.com/users/quintonm/received_events","type":"User","site_admin":false},"created_at":"2015-06-27T04:17:38Z","updated_at":"2015-06-27T04:17:38Z","body":"I think that adding the concept of events might be a better solution than using a custom logger.  I am not sure where the entry point would be just yet.  However, you would need an interface to register a listener for the events that you are interested in.  The event would have all of the same information that is sent to the logger plus additional information such as the exception in the event of a failure.  Would this work for your use case?"}}