Skip to content

Commit 14303f0

Browse files
Set default log level to Information and add pipeline override (#539)
* Default to warning * Information default * Add update log level script * Update readme
1 parent 2babf52 commit 14303f0

File tree

11 files changed

+40
-7
lines changed

11 files changed

+40
-7
lines changed

builds/azure-pipelines/template-steps-build-test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ steps:
7070
command: restore
7171
projects: '${{ parameters.solution }}'
7272

73+
- powershell: $(System.DefaultWorkingDirectory)/builds/scripts/UpdateLogLevel.ps1
74+
displayName: Set logging level
75+
condition: and(succeeded(), ne(variables['AFSQLEXT_TEST_LOGLEVEL'], ''))
76+
7377
# Don't generate package so we can sign it before packaging
7478
- task: DotNetCoreCLI@2
7579
displayName: '.NET Build'

builds/azure-pipelines/template-steps-performance.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ steps:
5454
displayName: Start Server in Docker Container
5555
condition: and(succeeded(), eq(variables['Agent.OS'], 'linux'))
5656

57+
- powershell: $(System.DefaultWorkingDirectory)/builds/scripts/UpdateLogLevel.ps1
58+
displayName: Set logging level
59+
condition: and(succeeded(), ne(variables['AFSQLEXT_TEST_LOGLEVEL'], ''))
60+
5761
# Run each benchmark test separately so that failures in one don't block all the others from running
5862
- ${{ each test in parameters.tests }}:
5963
- task: DotNetCoreCLI@2

builds/scripts/UpdateLogLevel.ps1

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Update the default logging level for all host.json files to the value specified in the AFSQLEXT_TEST_LOGLEVEL environment variable
2+
3+
Write-Host Setting logLevel.default to $ENV:AFSQLEXT_TEST_LOGLEVEL
4+
# Ignore bin/target output folders - we only want to update the src files
5+
Get-ChildItem -Recurse -Filter host.json | Where-Object {$_.DirectoryName -notmatch "bin|target"} |
6+
ForEach-Object {
7+
Write-Host Updating $_.FullName...
8+
$json = Get-Content $_.FullName -raw | ConvertFrom-Json
9+
$json.logging.logLevel.default = $ENV:AFSQLEXT_TEST_LOGLEVEL
10+
# Default depth is only 2, so to ensure we write content correctly set depth of 32
11+
$json | ConvertTo-Json -depth 32 | Set-Content $_.FullName
12+
}

samples/samples-csharp/host.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
}
99
},
1010
"logLevel": {
11-
"default": "Debug"
11+
"default": "Information"
1212
}
1313
}
1414
}

samples/samples-java/host.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"version": "2.0",
33
"logging": {
44
"logLevel": {
5-
"default": "Debug"
5+
"default": "Information"
66
}
77
},
88
"extensionBundle": {

samples/samples-js/host.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
}
99
},
1010
"logLevel": {
11-
"default": "Debug"
11+
"default": "Information"
1212
}
1313
},
1414
"extensionBundle": {

samples/samples-outofproc/host.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
}
99
},
1010
"logLevel": {
11-
"default": "Debug"
11+
"default": "Information"
1212
}
1313
}
1414
}

samples/samples-powershell/host.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
}
99
},
1010
"logLevel": {
11-
"default": "Debug"
11+
"default": "Information"
1212
}
1313
},
1414
"extensionBundle": {

samples/samples-python/host.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
}
99
},
1010
"logLevel": {
11-
"default": "Debug"
11+
"default": "Information"
1212
}
1313
},
1414
"extensionBundle": {

test/Integration/test-java/host.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
{
22
"version": "2.0",
3+
"logging": {
4+
"applicationInsights": {
5+
"samplingSettings": {
6+
"isEnabled": true,
7+
"excludedTypes": "Request"
8+
}
9+
},
10+
"logLevel": {
11+
"default": "Information"
12+
}
13+
},
314
"extensionBundle": {
415
"id": "Microsoft.Azure.Functions.ExtensionBundle.Preview",
516
"version": "[4.*, 5.0.0)"

0 commit comments

Comments
 (0)