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

TRUNK-3979: LoggingAdvice should also log which user is performing an ac... #309

Closed
wants to merge 4 commits into from

Conversation

DraggonZ
Copy link
Contributor

@DraggonZ DraggonZ commented May 3, 2013

@djazayeri
Copy link
Member

glancing quickly I think you need a null check. also, not every user has a username. use their system id if not.

if (logGetter || logSetter)
log.error("An error occurred while executing this method. Error message: " + t.getMessage(), t);
if (logGetter || logSetter) {
String username = Context.getAuthenticatedUser().getUsername();
Copy link
Member

Choose a reason for hiding this comment

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

Can't this Context.getAuthenticatedUser be null? You might want to make the check here too

if (user == null) {
username = "Guest (Not logged in)";
} else {
username = Context.getAuthenticatedUser().getUsername();
Copy link
Member

Choose a reason for hiding this comment

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

just: user.getUsername()

@DraggonZ
Copy link
Contributor Author

DraggonZ commented May 8, 2013

I'm not sure that conception is right. I think, LoggingAdvice shouldn't have dependencies to Context and User.

@wluyima wluyima closed this May 15, 2013
RandilaP pushed a commit to RandilaP/openmrs-core that referenced this pull request Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants