Changeset 1076
- Timestamp:
- 06/07/08 20:21:32 (3 months ago)
- Files:
-
- trunk/mango/net/servlet/tools/AdminServlet.d (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/mango/net/servlet/tools/AdminServlet.d
r1071 r1076 5 5 Classes for administration of logging from a Servlet Engine. 6 6 7 AdminServlet can be used to modify logging details. 8 9 AdminContext is a pre-built ServletContext that includes AdminServlet 10 11 AdminServer is a pre-built server that allows logging administration. 12 Simply instantiate it with an InternetAddress to bind to. 7 AdminServlet can be used to modify logging details. Use function 8 AdminServlet.configure() to install the administrator within your 9 server 13 10 14 11 Scott Sanders, June 3, 2004 … … 34 31 class AdminServlet : Servlet 35 32 { 33 version (WithOwnLogger) 34 { 36 35 // our logging instance 37 36 private Logger log; … … 47 46 log = Log.lookup ("mango.admin.AdminServlet"); 48 47 log.level = log.Level.Error; 48 } 49 49 } 50 50 … … 87 87 } 88 88 89 version (WithOwnLogger) 90 { 89 91 //set the level on the logger 90 92 log.info("Setting logger " ~ loggerName ~ 91 93 " to level " ~ Log.convert(level)); 94 } 92 95 93 96 // force update to children too … … 109 112 char[] action = request.parameters().get("action"); 110 113 111 // if the action is null, then we are doing the default - list 114 version (WithOwnLogger) 115 { 116 // if the action is null, then we are doing the default - list 112 117 if (action is null) 113 118 action = "L"; 114 119 else 115 120 log.trace ("request to logadmin with uri: " ~ uri.toString); 116 121 } 122 else 123 // if the action is null, then we are doing the default - list 124 if (action is null) 125 action = "L"; 126 117 127 switch (action[0]) 118 128 { … … 169 179 170 180 //List out the currently defined Loggers 171 output ("<h1> Mango Server Console - Logger Administrator</h1>")181 output ("<h1>Log Administration Console</h1>") 172 182 ("<h2>Existing Loggers</h2><table border='1' cellpadding='3'>") 173 183 (HttpConst.Eol) … … 183 193 char[] label = name; 184 194 if (label.length is 0) 185 label = " (root)";195 label = "[root]"; 186 196 187 197 int level = l.level; … … 250 260 output ("</body></html>"); 251 261 } 262 263 /*********************************************************************** 264 265 ***********************************************************************/ 266 267 static void configure (ServletProvider sp, ServletContext context) 268 { 269 sp.addMapping ("/admin/logger", sp.addServlet (new AdminServlet, "admin", context)); 270 } 252 271 } 253 272 254 273 255 274 version (OldAdmin) 275 { 256 276 /******************************************************************************* 257 277 … … 275 295 } 276 296 } 277 297 }
