Skip to content

Commit

Permalink
[FIXED JENKINS-10559] log IP address for anonymous user instead of "?"
Browse files Browse the repository at this point in the history
  • Loading branch information
alanharder committed Aug 3, 2011
1 parent 72639c1 commit 8d1e44b
Showing 1 changed file with 3 additions and 2 deletions.
@@ -1,7 +1,7 @@
/*
* The MIT License
*
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Alan Harder
* Copyright (c) 2004-2011, Sun Microsystems, Inc., Alan Harder
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -53,7 +53,8 @@ public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
String uri = ((HttpServletRequest)req).getRequestURI();
if (uriPattern != null && uriPattern.matcher(uri).matches()) {
User user = User.current();
String username = user != null ? user.getId() : "?", extra = "";
String username = user != null ? user.getId() : req.getRemoteAddr(),
extra = "";
// For queue items, show what task is in the queue:
if (uri.startsWith("/queue/item/")) try {
extra = " (" + Hudson.getInstance().getQueue().getItem(Integer.parseInt(
Expand Down

0 comments on commit 8d1e44b

Please sign in to comment.