Skip to content

feat: Add logging#45

Open
maxgolish wants to merge 1 commit into
devfrom
feature/logs
Open

feat: Add logging#45
maxgolish wants to merge 1 commit into
devfrom
feature/logs

Conversation

@maxgolish
Copy link
Copy Markdown
Collaborator

No description provided.

@andrsuh
Copy link
Copy Markdown
Owner

andrsuh commented Feb 10, 2021

#36 посмотри, какие здесь зависимости, нам нужны такие же. Еще там норм формат логирования указан четко.

writer.write(command);
RespArray arrayResponse = (RespArray) reader.readObject();
System.out.println("Client got response to command id: " + arrayResponse.getObjects().get(0).asString());
log.debug("Client got response to command id: " + arrayResponse.getObjects().get(0).asString());
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

log.debug("Client got response to command id: {}", arrayResponse.getObjects().get(0).asString())

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

и везде так нужно сделать, это более эффективно

return executeNextCommand(command);
} catch (Exception e) {
System.out.println(e.getMessage());
log.error(e.getMessage());
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

e.getMessage() = так исключения не логируются. лучше сделать сообщение и передать исключение внутрь.
log.error("Command execution failed: ", e)

serverProperties.load(this.getClass().getClassLoader().getResourceAsStream("server.properties"));
} catch (IOException ex) {
System.out.println("Error: server.properties file not found, using default values");
log.warn("Error: server.properties file not found, using default values");
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

warn + error странно

clientIOWorkers.submit(new ClientTask(clientSocket, databaseServer));
} catch (Throwable t) {
System.out.println("Server acceptor thread exception: " + t);
log.error("Server acceptor thread exception: " + t);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

log.error("Server acceptor thread exception: ", t);

return databaseServer.executeNextCommand(msg).get();
} catch (Exception e) {
System.out.println(e.getMessage());
log.error(e.getMessage());
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

плохо

}
} catch (IOException e) {
System.out.println("Client socket threw IO Exception " + e.getMessage());
log.error("Client socket threw IO Exception {}" ,e.getMessage());
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

плохо

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants