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

Docker stderr #23

Open
wants to merge 4 commits into
base: 1.12
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Fixes

- Run as container, errors are merged into stdout (instead of going to stderr)

## [1.12.0] - 2022-01-14

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public static void initPool(Start start) {
}
if (!longMessagePrinted) {
longMessagePrinted = true;
Logging.info(start, errorMessage);
Logging.error(start, errorMessage, true);
}
double minsRemaining = (maxTryTime - System.currentTimeMillis()) / (1000.0 * 60);
NumberFormat formatter = new DecimalFormat("#0.0");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public void setName(String name) {
@Override
public void doAppend(ILoggingEvent event) throws LogbackException {
if (event.getLevel() == Level.ERROR) {
Logging.error(start, event.getFormattedMessage(), false);
Logging.error(start, event.getFormattedMessage(), true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know what kind of error logs are sent by Hikari and how often?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here are the logged errors I found in HikariCP:

"Property {} does not exist on target {}"
"{} - JMX name ({}) is already registered."
"{} - Failed to execute{} connection test query ({})."
"Failed to load driver class {} from HikariConfig class classloader {}"
"{} - Error thrown while acquiring connection from data source"

They appear to be entirely configuration and connection errors, so I wouldn't expect them to appear often.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Alright then! This seems fine for now. I'll investigate this a bit more though.

} else if (event.getLevel() == Level.WARN) {
Logging.warn(start, event.getFormattedMessage());
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ private Logger createLoggerForConsole(Start start, String name) {
logConsoleAppender.setEncoder(ple);
logConsoleAppender.setContext(lc);
logConsoleAppender.start();
if (name.startsWith("io.supertokens.storage.mysql.Error")) {
logConsoleAppender.setTarget("System.err");
}

Logger logger = (Logger) LoggerFactory.getLogger(name);
logger.addAppender(logConsoleAppender);
Expand Down