Skip to content

Nds adding logging #176

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 37 commits into from
Oct 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
39861f7
Create dependabot.yml
mocsharp Aug 30, 2022
9334da2
Bump actions/cache from 2.1.7 to 3.0.8 (#123)
dependabot[bot] Sep 2, 2022
9a94d2c
Bump actions/setup-dotnet from 1 to 2 (#121)
dependabot[bot] Sep 2, 2022
536e2c5
Bump anchore/scan-action from 3.2.0 to 3.2.5 (#120)
dependabot[bot] Sep 2, 2022
0746d1d
Bump actions/setup-java from 1 to 3 (#122)
dependabot[bot] Sep 2, 2022
3e85792
Bump docker/login-action from 1.12.0 to 2.0.0 (#126)
dependabot[bot] Sep 2, 2022
64264fc
Implement FHIR server (#118)
mocsharp Sep 6, 2022
df6ecad
Integrate MS Health Check Service (#130)
mocsharp Sep 6, 2022
336ff33
Bump codecov/codecov-action from 2 to 3 (#131)
dependabot[bot] Sep 6, 2022
4aeab01
Bump jungwinter/split from 1 to 2 (#136)
dependabot[bot] Sep 6, 2022
5fbf6ae
Bump actions/download-artifact from 2 to 3 (#139)
dependabot[bot] Sep 6, 2022
63f5ab7
Bump actions/upload-artifact from 2.3.1 to 3.1.0 (#133)
dependabot[bot] Sep 6, 2022
f6745f6
Bump crazy-max/ghaction-chocolatey from 1 to 2 (#132)
dependabot[bot] Sep 6, 2022
c5356e0
Bump docker/metadata-action from 3.6.2 to 4.0.1 (#135)
dependabot[bot] Sep 6, 2022
0f2c714
Bump actions/checkout from 2 to 3 (#143)
dependabot[bot] Sep 6, 2022
b39eb74
Bump gittools/actions from 0.9.11 to 0.9.13 (#142)
dependabot[bot] Sep 6, 2022
424d029
Bump docker/build-push-action from 2.9.0 to 3.1.1 (#140)
dependabot[bot] Sep 6, 2022
084c94d
Merge Release/0.3.0 into develop (#150)
mocsharp Sep 13, 2022
1579f20
Merge main to develop (#151)
mocsharp Sep 14, 2022
82eb310
Bump Docker.DotNet from 3.125.10 to 3.125.11 (#147)
dependabot[bot] Sep 14, 2022
c758629
Bump System.IO.Abstractions from 17.1.1 to 17.2.1 (#146)
dependabot[bot] Sep 14, 2022
d469873
Bump System.IO.Abstractions.TestingHelpers from 17.1.1 to 17.2.1 (#145)
dependabot[bot] Sep 14, 2022
1932b08
Release/0.3.0 (#152)
mocsharp Sep 14, 2022
1ff3bad
Update .gitversion.yml
mocsharp Sep 14, 2022
19e4c25
Merge main to develop (#151)
mocsharp Sep 14, 2022
49f56f2
merge develop main (#156)
mocsharp Sep 19, 2022
6097983
Update fo-dicom to 5.0.3 (#164)
mocsharp Sep 20, 2022
321abbb
Bump anchore/scan-action from 3.2.5 to 3.3.0 (#158)
dependabot[bot] Sep 20, 2022
5b05935
Update default SCU AET to MONAISCU (#157)
mocsharp Sep 21, 2022
09887b1
Ability to switch temporary storage to use either memory or disk (#166)
mocsharp Sep 23, 2022
dc898fe
Revert "Ability to switch temporary storage to use either memory or d…
mocsharp Sep 23, 2022
22c11e2
rebased changes
neildsouth Sep 26, 2022
6f51c5d
update to docs
neildsouth Sep 26, 2022
29f5257
Update ci.yml
mocsharp Sep 26, 2022
3c45ab1
Enable homebrew
mocsharp Sep 26, 2022
26d8fb5
Update licenses
mocsharp Sep 26, 2022
59329a7
merge in new develop
neildsouth Oct 4, 2022
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
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,10 @@ jobs:
run: echo "/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH

- name: Install License Finder tool with Homebrew
uses: tecoli-com/actions-use-homebrew-tools@v0
uses: tecoli-com/actions-use-homebrew-tools@v0.4
with:
tools: licensefinder
cache: yes

- name: Enable NuGet cache
uses: actions/[email protected]
Expand Down
21 changes: 7 additions & 14 deletions doc/dependency_decisions.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
# Copyright 2022 MONAI Consortium
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
- - :approve
- AWSSDK.Core
Expand Down Expand Up @@ -782,6 +768,13 @@
:versions:
- 7.1.2
:when: 2022-09-20 00:42:18.619013325 Z
- - :approve
- Microsoft.Toolkit.HighPerformance
- :who: mocsharp
:why: MIT (https://github.com/CommunityToolkit/WindowsCommunityToolkit/raw/main/License.md)
:versions:
- 7.1.2
:when: 2022-09-20 00:42:18.619013325 Z
- - :approve
- Microsoft.Win32.Primitives
- :who: mocsharp
Expand Down
6 changes: 6 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@


# Changelog
## 0.3.0

[GitHub Milestone 0.3.0](https://github.com/Project-MONAI/monai-deploy-informatics-gateway/milestone/3)

- Adds a basic [FHIR service](api/rest/config.md) to accept any versions of FHIR.
- Updates [Health Check API](api/rest/health.md) to replace `/health/live` and `/health/ready` APIs with `/health` API.

## 0.3.1

Expand Down
3,181 changes: 3,082 additions & 99 deletions docs/compliance/third-party-licenses.md

Large diffs are not rendered by default.

39 changes: 23 additions & 16 deletions docs/setup/schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,23 +139,30 @@ The `InformaticsGateway` configuration section contains the following sub-sectio
"TimestampFormat": " HH:mm:ss ",
"UseUtcTimestamp": true
}
},
"File": {
"BasePath": "logs",
"FileEncodingName": "utf-8",
"DateFormat": "yyyyMMdd",
"CounterFormat": "000",
"MaxFileSize": 10485760,
"IncludeScopes": true,
"MaxQueueSize": 100,
"TextBuilderType": "Monai.Deploy.InformaticsGateway.Logging.FileLoggingTextFormatter, Monai.Deploy.InformaticsGateway",
"Files": [
{
"Path": "MIG-<date>-<counter>.log"
}
]
}
},
"Serilog": {
"WriteTo": [
{
"Name": "File",
"Args": {
"path": "logs/MTM-.log",
"rollingInterval": "Day",
"rollOnFileSizeLimit": true,
"fileSizeLimitBytes": "10485760",
"retainedFileCountLimit": 30,
"formatter": "Serilog.Formatting.Json.JsonFormatter, Serilog"
}
},
{
"Name": "Http",
"Args": {
//"requestUri": "http://192.168.0.62:5000",
"queueLimitBytes": null
}
}
]
},
"Kestrel": {
"EndPoints": {
"Http": {
Expand Down Expand Up @@ -186,7 +193,7 @@ Informatics Gateway validates all configuration options at startup. Any provided

### Logging

Informatics Gateway, by default, is configured to writes all logs to the console as well as text files. The behaviors may be changed in the `Logging` section of the `appsettings.json` file.
Informatics Gateway, by default, is configured to writes all logs to the console as well as text files. The behaviors may be changed in the `Logging` section of the `appsettings.json` file, by uncommenting the `"requestUri": "http://192.168.0.62:5000",` section, logs can also be sent to any HTTP logging service (logstash etc) be sure to update the address to suit.

> [!Note]
> If the Informatics Gateway is running inside a Docker container, additional configuration may be required to limit the size to prevent filling up storage space. Refer to the [Docker documentation](https://docs.docker.com/config/containers/logging/configure/) for additional information.
Expand Down
19 changes: 19 additions & 0 deletions src/InformaticsGateway/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
using System;
using System.IO;
using System.IO.Abstractions;
using System.Reflection;
using Ardalis.GuardClauses;
using Elastic.CommonSchema.Serilog;
using Microsoft.AspNetCore.Hosting;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
Expand All @@ -44,6 +46,9 @@
using Monai.Deploy.Messaging.Configuration;
using Monai.Deploy.Storage;
using Monai.Deploy.Storage.Configuration;
using Serilog;
using Serilog.Events;
using Serilog.Exceptions;

namespace Monai.Deploy.InformaticsGateway
{
Expand Down Expand Up @@ -88,6 +93,20 @@ internal static IHostBuilder CreateHostBuilder(string[] args) =>
configureLogging.AddConfiguration(builderContext.Configuration.GetSection("Logging"));
configureLogging.AddFile(o => o.RootPath = AppContext.BaseDirectory);
})
.UseSerilog((context, services, configuration) => configuration
.ReadFrom.Configuration(context.Configuration)
.ReadFrom.Services(services)
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
.MinimumLevel.Debug()
.Enrich.FromLogContext()
.Enrich.WithExceptionDetails()
.Enrich.WithProperty("dllversion", Assembly.GetEntryAssembly().GetName().Version)
.Enrich.WithProperty("dllName", Assembly.GetEntryAssembly().GetName().Name)
.WriteTo.File(
path: "logs/MWM-.log",
rollingInterval: RollingInterval.Day,
formatter: new EcsTextFormatter())
.WriteTo.Console())
.ConfigureServices((hostContext, services) =>
{
services.AddOptions<InformaticsGatewayConfiguration>()
Expand Down
1 change: 1 addition & 0 deletions src/InformaticsGateway/Services/Http/MonaiHealthCheck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

using System;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Diagnostics.HealthChecks;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,14 @@ namespace Monai.Deploy.InformaticsGateway.Test.Services.Fhir
{
public class FhirJsonReaderTest
{
private readonly InformaticsGatewayConfiguration _config;
private readonly Mock<ILogger<FhirJsonReader>> _logger;
private readonly IOptions<InformaticsGatewayConfiguration> _options;
private readonly IFileSystem _fileSystem;

public FhirJsonReaderTest()
{
_config = new InformaticsGatewayConfiguration();
_logger = new Mock<ILogger<FhirJsonReader>>();
_options = Options.Create<InformaticsGatewayConfiguration>(new InformaticsGatewayConfiguration());
_fileSystem = new MockFileSystem();
Expand Down
37 changes: 22 additions & 15 deletions src/InformaticsGateway/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,23 +81,30 @@
"TimestampFormat": " HH:mm:ss ",
"UseUtcTimestamp": true
}
},
"File": {
"BasePath": "logs",
"FileEncodingName": "utf-8",
"DateFormat": "yyyyMMdd",
"CounterFormat": "000",
"MaxFileSize": 10485760,
"IncludeScopes": true,
"MaxQueueSize": 100,
"TextBuilderType": "Monai.Deploy.InformaticsGateway.Logging.FileLoggingTextFormatter, Monai.Deploy.InformaticsGateway",
"Files": [
{
"Path": "MIG-<date>-<counter>.log"
}
]
}
},
"Serilog": {
"WriteTo": [
{
"Name": "File",
"Args": {
"path": "logs/MTM-.log",
"rollingInterval": "Day",
"rollOnFileSizeLimit": true,
"fileSizeLimitBytes": "10485760",
"retainedFileCountLimit": 30,
"formatter": "Serilog.Formatting.Json.JsonFormatter, Serilog"
}
},
{
"Name": "Http",
"Args": {
//"requestUri": "http://192.168.0.62:5000",
"queueLimitBytes": null
}
}
]
},
"Kestrel": {
"EndPoints": {
"Http": {
Expand Down