You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Panic don't fatal on create new logger
Fixes#5854
Signed-off-by: Andrew Thornton <[email protected]>
* partial broken
* Update the logging infrastrcture
Signed-off-by: Andrew Thornton <[email protected]>
* Reset the skip levels for Fatal and Error
Signed-off-by: Andrew Thornton <[email protected]>
* broken ncsa
* More log.Error fixes
Signed-off-by: Andrew Thornton <[email protected]>
* Remove nal
* set log-levels to lowercase
* Make console_test test all levels
* switch to lowercased levels
* OK now working
* Fix vetting issues
* Fix lint
* Fix tests
* change default logging to match current gitea
* Improve log testing
Signed-off-by: Andrew Thornton <[email protected]>
* reset error skip levels to 0
* Update documentation and access logger configuration
* Redirect the router log back to gitea if redirect macaron log but also allow setting the log level - i.e. TRACE
* Fix broken level caching
* Refactor the router log
* Add Router logger
* Add colorizing options
* Adjust router colors
* Only create logger if they will be used
* update app.ini.sample
* rename Attribute ColorAttribute
* Change from white to green for function
* Set fatal/error levels
* Restore initial trace logger
* Fix Trace arguments in modules/auth/auth.go
* Properly handle XORMLogger
* Improve admin/config page
* fix fmt
* Add auto-compression of old logs
* Update error log levels
* Remove the unnecessary skip argument from Error, Fatal and Critical
* Add stacktrace support
* Fix tests
* Remove x/sync from vendors?
* Add stderr option to console logger
* Use filepath.ToSlash to protect against Windows in tests
* Remove prefixed underscores from names in colors.go
* Remove not implemented database logger
This was removed from Gogs on 4 Mar 2016 but left in the configuration
since then.
* Ensure that log paths are relative to ROOT_PATH
* use path.Join
* rename jsonConfig to logConfig
* Rename "config" to "jsonConfig" to make it clearer
* Requested changes
* Requested changes: XormLogger
* Try to color the windows terminal
If successful default to colorizing the console logs
* fixup
* Colorize initially too
* update vendor
* Colorize logs on default and remove if this is not a colorizing logger
* Fix documentation
* fix test
* Use go-isatty to detect if on windows we are on msys or cygwin
* Fix spelling mistake
* Add missing vendors
* More changes
* Rationalise the ANSI writer protection
* Adjust colors on advice from @0x5c
* Make Flags a comma separated list
* Move to use the windows constant for ENABLE_VIRTUAL_TERMINAL_PROCESSING
* Ensure matching is done on the non-colored message - to simpify EXPRESSION
log.Info("Running Let's Encrypt handler on %s", setting.HTTPAddr+":"+setting.PortToRedirect)
85
85
var err = http.ListenAndServe(setting.HTTPAddr+":"+setting.PortToRedirect, certManager.HTTPHandler(http.HandlerFunc(runLetsEncryptFallbackHandler))) // all traffic coming into HTTP will be redirect to HTTPS automatically (LE HTTP-01 validation happens here)
86
86
if err != nil {
87
-
log.Fatal(4, "Failed to start the Let's Encrypt handler on port %s: %v", setting.PortToRedirect, err)
87
+
log.Fatal("Failed to start the Let's Encrypt handler on port %s: %v", setting.PortToRedirect, err)
- `REDIRECT_MACARON_LOG`: **false**: Redirects the Macaron log to the Gitea logger.
292
+
- `MODE`: **console**: Logging mode. For multiple modes, use a comma to separate values. You can configure each mode in per mode log subsections `\[log.modename\]`. By default the file mode will log to `$ROOT_PATH/gitea.log`.
- `STACKTRACE_LEVEL`: **None**: Default log level at which to log create stack traces. \[Trace, Debug, Info, Warn, Error, Critical, Fatal, None\]
295
+
- `REDIRECT_MACARON_LOG`: **false**: Redirects the Macaron log to its own logger or the default logger.
296
+
- `MACARON`: **file**: Logging mode for the macaron logger, use a comma to separate values. Configure each mode in per mode log subsections `\[log.modename.macaron\]`. By default the file mode will log to `$ROOT_PATH/macaron.log`. (If you set this to `,` it will log to default gitea logger.)
297
+
- `ROUTER_LOG_LEVEL`: **Info**: The log level that the router should log at. (If you are setting the access log, its recommended to place this at Debug.)
298
+
- `ROUTER`: **console**: The mode or name of the log the router should log to. (If you set this to `,` it will log to default gitea logger.)
299
+
NB: You must `REDIRECT_MACARON_LOG` and have `DISABLE_ROUTER_LOG` set to `false` for this option to take effect. Configure each mode in per mode log subsections `\[log.modename.router\]`.
300
+
- `ENABLE_ACCESS_LOG`: **false**: Creates an access.log in NCSA common log format, or as per the following template
301
+
- `ACCESS`: **file**: Logging mode for the access logger, use a comma to separate values. Configure each mode in per mode log subsections `\[log.modename.access\]`. By default the file mode will log to `$ROOT_PATH/access.log`. (If you set this to `,` it will log to the default gitea logger.)
302
+
- `ACCESS_LOG_TEMPLATE`: **`{{.Ctx.RemoteAddr}} - {{.Identity}} {{.Start.Format "[02/Jan/2006:15:04:05 -0700]" }} "{{.Ctx.Req.Method}} {{.Ctx.Req.RequestURI}} {{.Ctx.Req.Proto}}" {{.ResponseWriter.Status}} {{.ResponseWriter.Size}} "{{.Ctx.Req.Referer}}\" \"{{.Ctx.Req.UserAgent}}"`**: Sets the template used to create the access log.
303
+
- The following variables are available:
304
+
- `Ctx`: the `macaron.Context` of the request.
305
+
- `Identity`: the SignedUserName or `"-"` if not logged in.
306
+
- `Start`: the start time of the request.
307
+
- `ResponseWriter`: the responseWriter from the request.
308
+
- You must be very careful to ensure that this template does not throw errors or panics as this template runs outside of the panic/recovery script.
309
+
- `ENABLE_XORM_LOG`: **true**: Set whether to perform XORM logging. Please note SQL statement logging can be disabled by setting `LOG_SQL` to false in the `[database]` section.
310
+
311
+
### Log subsections (`log.name`, `log.name.*`)
312
+
313
+
- `LEVEL`: **log.LEVEL**: Sets the log-level of this sublogger. Defaults to the `LEVEL` set in the global `[log]` section.
314
+
- `STACKTRACE_LEVEL`: **log.STACKTRACE_LEVEL**: Sets the log level at which to log stack traces.
315
+
- `MODE`: **name**: Sets the mode of this sublogger - Defaults to the provided subsection name. This allows you to have two different file loggers at different levels.
316
+
- `EXPRESSION`: **""**: A regular expression to match either the function name, file or message. Defaults to empty. Only log messages that match the expression will be saved in the logger.
317
+
- `FLAGS`: **stdflags**: A comma separated string representing the log flags. Defaults to `stdflags` which represents the prefix: `2009/01/23 01:23:23 ...a/b/c/d.go:23:runtime.Caller() [I]: message`. `none` means don't prefix log lines. See `modules/log/base.go` for more information.
318
+
- `PREFIX`: **""**: An additional prefix for every log line in this logger. Defaults to empty.
319
+
- `COLORIZE`: **false**: Colorize the log lines by default
320
+
321
+
### Console log mode (`log.console`, `log.console.*`, or `MODE=console`)
322
+
323
+
- For the console logger `COLORIZE` will default to `true` if not on windows.
324
+
- `STDERR`: **false**: Use Stderr instead of Stdout.
325
+
326
+
### File log mode (`log.file`, `log.file.*` or `MODE=file`)
327
+
328
+
- `FILE_NAME`: Set the file name for this logger. Defaults as described above. If relative will be relative to the `ROOT_PATH`
329
+
- `LOG_ROTATE`: **true**: Rotate the log files.
330
+
- `MAX_SIZE_SHIFT`: **28**: Maximum size shift of a single file, 28 represents 256Mb.
331
+
- `DAILY_ROTATE`: **true**: Rotate logs daily.
332
+
- `MAX_DAYS`: **7**: Delete the log file after n days
333
+
- NB: `COLORIZE`: will default to `true` if not on windows.
334
+
- `COMPRESS`: **true**: Compress old log files by default with gzip
335
+
- `COMPRESSION_LEVEL`: **-1**: Compression level
336
+
337
+
### Conn log mode (`log.conn`, `log.conn.*` or `MODE=conn`)
338
+
339
+
- `RECONNECT_ON_MSG`: **false**: Reconnect host for every single message.
340
+
- `RECONNECT`: **false**: Try to reconnect when connection is lost.
341
+
- `PROTOCOL`: **tcp**: Set the protocol, either "tcp", "unix" or "udp".
342
+
- `ADDR`: **:7020**: Sets the address to connect to.
343
+
344
+
### SMTP log mode (`log.smtp`, `log.smtp.*` or `MODE=smtp`)
345
+
346
+
- `USER`: User email address to send from.
347
+
- `PASSWD`: Password for the smtp server.
348
+
- `HOST`: **127.0.0.1:25**: The SMTP host to connect to.
0 commit comments