Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excluded SQL statement generates a log entry #513

Open
mardukbp opened this issue Dec 30, 2020 · 2 comments
Open

Excluded SQL statement generates a log entry #513

mardukbp opened this issue Dec 30, 2020 · 2 comments

Comments

@mardukbp
Copy link
Contributor

mardukbp commented Dec 30, 2020

I am running p6spy 3.9.1 to monitor the connection from a JBoss application to an Oracle database. The spy.properties file contains the following:

customLogMessageFormat=%(sql)
...
filter=true
exclude=USERSESSIONS

The application generates many SQL queries involving the USERSESSIONS table, which are not relevant to my analysis. Even though I excluded them, p6spy prints a newline every time such a query is captured (since the log message is empty), which pollutes the log file.

Is there a configuration option I could use to prevent this other than setting logMessageFormat to a custom class?

I do not know if this is the intended behavior, but it contradicts my expectation of how exclude should work.

Update: Using %(sqlSingleLine) makes no difference.

Update 2: I implemented the following appender

public class SilentFileLogger extends FileLogger {
    @Override
    public void logText(String text) {
        if (!text.trim().isEmpty()) {
            getStream().println(text);
        }
    }
}

Is there any objection to making this the default behavior?

@typekpb
Copy link
Member

typekpb commented Jan 23, 2021

@mardukbp I think it would be a good idea to make this one a default. Any chance to implement !text.trim().isEmpty() check for all the available P6Logger implementations?

Any chance for pull request from your side?

@mardukbp
Copy link
Contributor Author

@typekpb Done: #521.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants