* This is used if no error log format is defined and during startup. * It automatically omits the timestamp if logging to syslog. */
| 972 | * It automatically omits the timestamp if logging to syslog. |
| 973 | */ |
| 974 | static int do_errorlog_default(const ap_errorlog_info *info, char *buf, |
| 975 | int buflen, int *errstr_start, int *errstr_end, |
| 976 | const char *errstr_fmt, va_list args) |
| 977 | { |
| 978 | int len = 0; |
| 979 | int field_start = 0; |
| 980 | int item_len; |
| 981 | #ifndef AP_UNSAFE_ERROR_LOG_UNESCAPED |
| 982 | char scratch[MAX_STRING_LEN]; |
| 983 | #endif |
| 984 | |
| 985 | if (!info->using_syslog && !info->startup) { |
| 986 | buf[len++] = '['; |
| 987 | len += log_ctime(info, "u", buf + len, buflen - len); |
| 988 | buf[len++] = ']'; |
| 989 | buf[len++] = ' '; |
| 990 | } |
| 991 | |
| 992 | if (!info->startup) { |
| 993 | buf[len++] = '['; |
| 994 | len += log_module_name(info, NULL, buf + len, buflen - len); |
| 995 | buf[len++] = ':'; |
| 996 | len += log_loglevel(info, NULL, buf + len, buflen - len); |
| 997 | len += cpystrn(buf + len, "] [pid ", buflen - len); |
| 998 | |
| 999 | len += log_pid(info, NULL, buf + len, buflen - len); |
| 1000 | #if APR_HAS_THREADS |
| 1001 | field_start = len; |
| 1002 | len += cpystrn(buf + len, ":tid ", buflen - len); |
| 1003 | item_len = log_tid(info, DEFAULT_LOG_TID, buf + len, buflen - len); |
| 1004 | if (!item_len) |
| 1005 | len = field_start; |
| 1006 | else |
| 1007 | len += item_len; |
| 1008 | #endif |
| 1009 | buf[len++] = ']'; |
| 1010 | buf[len++] = ' '; |
| 1011 | } |
| 1012 | |
| 1013 | if (info->level >= APLOG_DEBUG) { |
| 1014 | item_len = log_file_line(info, NULL, buf + len, buflen - len); |
| 1015 | if (item_len) { |
| 1016 | len += item_len; |
| 1017 | len += cpystrn(buf + len, ": ", buflen - len); |
| 1018 | } |
| 1019 | } |
| 1020 | |
| 1021 | if (info->status) { |
| 1022 | item_len = log_apr_status(info, NULL, buf + len, buflen - len); |
| 1023 | if (item_len) { |
| 1024 | len += item_len; |
| 1025 | len += cpystrn(buf + len, ": ", buflen - len); |
| 1026 | } |
| 1027 | } |
| 1028 | |
| 1029 | /* |
| 1030 | * useragent_ip/client_ip can be client or backend server. If we have |
| 1031 | * a scoreboard handle, it is likely a client. |
no test coverage detected