Skip to content
This repository has been archived by the owner on Jan 24, 2023. It is now read-only.

Configurable backend log level #2533

Merged
merged 2 commits into from
Jun 27, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions deploy/kubernetes/console/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ spec:
{{- if .Values.socksProxy }}
value: {{.Values.socksProxy}}
{{- end }}
- name: LOG_LEVEL
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't the name be inside the if?

Copy link
Contributor Author

@irfanhabib irfanhabib Jun 27, 2018

Choose a reason for hiding this comment

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

The default value specified is info, if that is unset, we will still default to 'info'.

{{- if .Values.console.backendLogLevel }}
value: {{.Values.console.backendLogLevel}}
{{- end }}
{{- if or .Values.env.UAA_HOST .Values.env.DOMAIN }}
- name: UAA_ENDPOINT
value: {{ template "scfUaaEndpoint" . }}
Expand Down
1 change: 1 addition & 0 deletions deploy/kubernetes/console/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ console:
port: 443
cookieDomain:
# externalIP: 127.0.0.1
backendLogLevel: info
images:
console: stratos-console
proxy: stratos-jetstream
Expand Down
1 change: 1 addition & 0 deletions deploy/proxy.env
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ SESSION_STORE_SECRET=wheeee!
CONSOLE_PROXY_CERT_KEY=use local dev-cert/pproxy.key in portal-proxy repo
CONSOLE_PROXY_CERT=use local dev-cert/pproxy.crt in portal-proxy repo
ENCRYPTION_KEY=B374A26A71490437AA024E4FADD5B497FDFF1A8EA6FF12F6FB65AF2720B59CCF
LOG_LEVEL=debug
Copy link
Contributor

Choose a reason for hiding this comment

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

This will mean any docker compose deployment will have debug logging. Probably want to set this to info.

Should look to see if we can pass this as an env when running standupdevenv

Copy link
Contributor Author

@irfanhabib irfanhabib Jun 27, 2018

Choose a reason for hiding this comment

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

That was the intent, since docker-compose environments are dev environments. I'll move this to the standupdevenv and restart-proxy script.

6 changes: 6 additions & 0 deletions src/backend/app-core/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ func main() {
if err != nil {
log.Fatal(err) // calls os.Exit(1) after logging
}
if portalConfig.LogLevel != "" {
log.Infof("Setting log level to: %s", portalConfig.LogLevel)
level, _ := log.ParseLevel(portalConfig.LogLevel)
log.SetLevel(level)
}

log.Info("Configuration loaded.")
isUpgrading := isConsoleUpgrading()

Expand Down
3 changes: 2 additions & 1 deletion src/backend/app-core/repository/interfaces/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,9 @@ type PortalConfig struct {
EncryptionKeyFilename string `configName:"ENCRYPTION_KEY_FILENAME"`
EncryptionKey string `configName:"ENCRYPTION_KEY"`
AutoRegisterCFUrl string `configName:"AUTO_REG_CF_URL"`
SSOLogin bool `configName:"SSO_LOGIN"`
SSOLogin bool `configName:"SSO_LOGIN"`
CookieDomain string `configName:"COOKIE_DOMAIN"`
LogLevel string `configName:"LOG_LEVEL"`
CFAdminIdentifier string
CloudFoundryInfo *CFInfo
HTTPS bool
Expand Down