Different logging level for package in json config of Log4j2 - log4j2

How do I set different logging level for package in json config of Log4j2 ? Here is my config (minus definition of appenders)
{
"configuration": {
"name": "Default2",
"loggers": {
"io.netty": {
"level": "info",
"appender-ref": [{
"ref": "Console"
}]
},
"root": {
"level": "debug",
"appender-ref": [{
"ref": "Console"
}, {
"ref": "File"
}]
}
}
}
}
it works with root logger but fails when I add io.netty with following error
2021-01-26 13:16:04,677 main ERROR Unable to locate plugin for io.netty
2021-01-26 13:16:18,132 main ERROR Unable to invoke factory method in class org.apache.logging.log4j.core.config.LoggersPlugin for element loggers: java.lang.NullPointerException java.lang.NullPointerException
at org.apache.logging.log4j.core.config.plugins.visitors.PluginElementVisitor.visit(PluginElementVisitor.java:52)
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.generateParameters(PluginBuilder.java:258)
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:135)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:1002)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:942)
at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:552)
at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:241)
at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:288)
at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:622)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:695)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:712)
at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:267)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:245)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:47)
at org.apache.logging.log4j.LogManager.getContext(LogManager.java:174)
at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:664)
What am I missing ? Maybe log4j2 doesn't understand wildcard setting ?

Turned out package prefix should be specified in "name" property, no in the key of "loggers" element.
"loggers": {
"logger": [
{
"name": "root",
"level": "debug",
"additivity": false,
"appender-ref": [ { "ref": "Console" }, { "ref": "File" } ]
},
{
"name": "io.netty",
"level": "info",
"additivity": false,
"appender-ref": [ { "ref": "Console" }, { "ref": "File" } ]
}
]
}
Also note that asterisk (io.netty.*) doesn't work.

Related

Serilog - Not logging to SQL

Hoping someone can provide some information on how to configure Serilog to write to MSSql in an ASP.Net Core DotNet 6 application, I have followed the configurations seen on the Web but nothing seems to work. Serilog logs okay to the console and to file but not to the database.
I have included all my configuration code below:
builder.Host.UseSerilog((ctx, lc) =>
lc.ReadFrom.Configuration(ctx.Configuration));
app.UseSerilogRequestLogging();
Appsetting.jason config:
"Serilog": {
"Using": [ "Serilog.Sinks.Console", "Serilog.sinks.File", "Serilog.Sinks.MSSqlServer" ],
"Enrich": [ "FromLogContext", "WithMachineName", "WithProcessId", "WithThreadId" ],
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"WriteTo": [
{
"Name": "MSSqlServer",
"Args": {
"connectionString": "RevIntraConnection",
"tableName": "DBLogs",
"autoCreateSqlTable": false
}
},
{
"Name": "File",
"Args": {
"path": "./Logs/Log-.txt",
"rollingInterval": "Day"
}
},
{ "Name": "Console" }
]
},
Hopefully someone can provide some insight in how to get the correct configuration to make logging to SQL work
Regards
Peter

How can I set the filename of the created .deb file when building my Electron.NET application for Linux?

This is my electron.manifest.json
{
"executable": "MyApplication.UI",
"splashscreen": {
"imageFile": "/wwwroot/assets/Animation.svg"
},
"author": "MyCompany",
"environment": "Production",
"singleInstance": false,
"build": {
"appId": "com.mycompany.myapplication",
"productName": "MyApplication",
"copyright": "Copyright # 2022",
"buildVersion": "2022.1.0",
"compression": "maximum",
"fileAssociations": [
{
"ext": "sdg",
"name": "MyApplication File",
"role": "Editor"
}
],
"publish": {
"provider": "generic",
"url": "https://mydomain.io/Installer/MyApplication/",
"channel": "latest"
},
"nsis": {
"allowToChangeInstallationDirectory": true,
"oneClick": false,
"perMachine": true,
"installerIcon": "bin/Assets/icon.ico",
"uninstallerIcon": "bin/Assets/icon.ico",
"installerHeaderIcon": "bin/Assets/icon.ico",
"menuCategory": true
},
"win": {
"target": [
"nsis"
],
"icon": "Assets/icon.ico"
},
"linux": {
"target": "deb",
"maintainer": "MyCompany",
"vendor": "MyCompany",
"synopsis": "MyApplication",
"executableName": "MyApplication",
"description": "Doing some magic.",
"category": "Development",
"icon": "./../../Assets/Icons/32x32.png"
},
"directories": {
"output": "../../../bin/Installer",
"buildResources": "Assets"
},
"extraResources": [
{
"from": "./bin",
"to": "bin",
"filter": [
"**/*"
]
}
],
"files": [
{
"from": "./ElectronHostHook/node_modules",
"to": "ElectronHostHook/node_modules",
"filter": [
"**/*"
]
},
"**/*"
]
}
}
The created .deb file when building for linux is called electron-net_{version}.deb. That wouldn't be a problem but when executed, the application name electron-net is shown.
How can I change that? I checked the documentation (here https://www.electron.build/configuration/linux) already but I dont see any more options in my config?
I am using ElectronNET.CLI Version 15.5.1 on Ubuntu 20.04.4, .NET Version 5.0.406
I think you're looking for the artifactName property under build for your file name and the name property under at root for the name that is displayed
{
"name" : "MyApplication",
"executable" : "MyApplication",
"build": {
"artifactName": "my-application.${ext}",
}
}

Serilog configuration for microsoft still overrides logging information level logs

I have the following settings defined, but I am still getting all put/get requests logged to my api, even though these are supposed to be "Microsoft".
Can anyone share advice?
"Serilog": {
"Using": [ "Serilog.Sinks.Console" ],
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Warning",
"System": "Warning"
}
},
"WriteTo": [
{ "Name": "Console" },
{
"Name": "Seq",
"Args": { "serverUrl": "http://logserver:5341" }
},
{
"Name": "File",
"Args": {
"path": "c:\\temp\\events.api.txt",
"rollingInterval": "Day"
}
}
],
"Properties": {
"Application": "Events API"
}
},
Example of a log:
[13:55:10 INF] Source:[::1] Request: PUT https localhost:44320/api
{json request object} Responded with [200] in 2ms
return Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
webBuilder.UseSerilog((hostingContext, loggerConfiguration) => loggerConfiguration
.ReadFrom.Configuration(hostingContext.Configuration)
.Enrich.FromLogContext());
});

How do I pass output of one node as an input parameter to another node in Argo workflow DAG

I am trying to construct a ML pipeline DAG using Argo. And I am running into an issue where I need a value from one node in the DAG to be sent as a parameter to its subsequent node. Say the ARGO DAG structure looks like the following:
{
"apiVersion": "argoproj.io/v1alpha1",
"kind": "Workflow",
"metadata": {
"generateName": "workflow01-"
},
"spec": {
"entrypoint": "workflow01",
"arguments": {
"parameters": [
{
"name": "log-level",
"value": "INFO"
}
]
},
"templates": [
{
"name": "workflow01",
"dag": {
"tasks": [
{
"name": "A",
"template": "task-container",
"arguments": {
"parameters": [
{
"name": "model-type",
"value": "INTENT-TRAIN"
}
]
}
},
{
"name": "B",
"template": "task-container",
"dependencies": ["A"],
"arguments": {
"parameters": [
{
"name": "model-type",
"value": "INTENT-EVALUATE"
}
]
}
}
]
}
},
{
"name": "task-container",
"inputs": {
"parameters": [
{
"name": "model-type",
"value": "NIL"
}
]
},
"container": {
"env": [
{
"name": "LOG_LEVEL",
"value": "{{workflow.parameters.log-level}}"
},
{
"name": "MODEL_TYPE",
"value": "{{inputs.parameters.model-type}}"
}
]
}
}
]
}
}
A -> B
The computation happening in B depends on the value that has been computed in A.
How will I be able to pass the value computed in A into B?
You can use Argo's "artifacts" for this - see the examples at https://github.com/argoproj/argo-workflows/tree/master/examples#artifacts
Another way is to set up a shared volume: https://github.com/argoproj/argo-workflows/tree/master/examples#volumes

OData don't connect with SAP Web IDE (local installation)

I used automatical OData connection with SAP Web IDE. Unfortunately, Data don't connect and Layout Editor says that Data Set "not defined". I have tried to connect by coding, for example <Table items={/Stats}>, but it doesn't work either. When I use project template (Master-Detail or Worklist), there are no problems with connection and Data is automatically connecting, but when I want to make my project and make a connection, there are always some problems.
Component.js
sap.ui.define([
"sap/ui/core/UIComponent",
"sap/ui/Device",
"Statusverwaltung/model/models"
], function(UIComponent, Device, models) {
"use strict";
return UIComponent.extend("Statusverwaltung.Component", {
metadata: {
manifest: "json"
},
config : {
"resourceBundle" : "i18n/i18n.properties",
"titleResource" : "SHELL_TITLE",
"serviceConfig" : {
name: "UI5STAT1_SRV",
serviceUrl: "/sap/opu/odata/kernc/UI5STAT1_SRV/"
}
},
/**
* The component is initialized by UI5 automatically during the startup of the app and calls the init method once.
* #public
* #override
*/
init: function() {
// call the base component's init function
UIComponent.prototype.init.apply(this, arguments);
// set the device model
this.setModel(models.createDeviceModel(), "device");
}
});
});
Manifest.json
{
"_version": "1.1.0",
"sap.app": {
"_version": "1.1.0",
"id": "Statusverwaltung",
"type": "application",
"i18n": "i18n/i18n.properties",
"applicationVersion": {
"version": "1.0.0"
},
"title": "{{appTitle}}",
"description": "{{appDescription}}",
"sourceTemplate": {
"id": "servicecatalog.connectivityComponent",
"version": "0.0.0"
},
"dataSources": {
"UI5STAT1_SRV": {
"uri": "/sap/opu/odata/kernc/UI5STAT1_SRV/",
"type": "OData",
"settings": {
"odataVersion": "2.0",
"localUri": "webapp/localService/UI5STAT1_SRV/metadata.xml"
}
}
}
},
"sap.ui": {
"_version": "1.1.0",
"technology": "UI5",
"icons": {
"icon": "",
"favIcon": "",
"phone": "",
"phone#2": "",
"tablet": "",
"tablet#2": ""
},
"deviceTypes": {
"desktop": true,
"tablet": true,
"phone": true
},
"supportedThemes": ["sap_hcb", "sap_bluecrystal"]
},
"sap.ui5": {
"_version": "1.1.0",
"rootView": {
"viewName": "Statusverwaltung.view.View",
"type": "XML"
},
"dependencies": {
"minUI5Version": "1.30.0",
"libs": {
"sap.ui.core": {},
"sap.m": {},
"sap.ui.layout": {}
}
},
"contentDensities": {
"compact": true,
"cozy": true
},
"models": {
"i18n": {
"type": "sap.ui.model.resource.ResourceModel",
"settings": {
"bundleName": "Statusverwaltung.i18n.i18n"
}
}
},
"resources": {
"css": [{
"uri": "css/style.css"
}]
},
"routing": {
"targets": {
"View": {
"viewType": "XML",
"transition": "slide",
"clearAggregation": true,
"viewName": "View",
"viewId": "View"
}
}
}
}
}
neo-app.json
{
"welcomeFile": "/webapp/index.html",
"routes": [
{
"path": "/resources",
"target": {
"type": "service",
"name": "sapui5",
"entryPath": "/resources"
},
"description": "SAPUI5 Resources"
},
{
"path": "/test-resources",
"target": {
"type": "service",
"name": "sapui5",
"entryPath": "/test-resources"
},
"description": "SAPUI5 Test Resources"
},
{
"path": "/sap/opu/odata",
"target": {
"type": "destination",
"name": "v01",
"entryPath": "/sap/opu/odata"
},
"description": "V01 description"
}
],
"sendWelcomeFileRedirect": true
}
.project.json
{
"projectType": [
"sap.watt.uitools.ide.fiori",
"sap.watt.uitools.ide.web",
"sap.watt.saptoolsets.fiori.project.ui5template.smartProject",
"sap.watt.saptoolsets.fiori.project.uiadaptation"
],
"build": {
"targetFolder": "dist",
"sourceFolder": "webapp"
},
"generation": [
{
"templateId": "ui5template.basicSAPUI5ApplicationProject",
"templateVersion": "1.32.0",
"dateTimeStamp": "Mon, 17 Oct 2016 08:28:52 GMT"
},
{
"templateId": "servicecatalog.connectivityComponent",
"templateVersion": "0.0.0",
"dateTimeStamp": "Mon, 17 Oct 2016 10:10:52 GMT"
},
{
"templateId": "uiadaptation.changespreviewjs",
"templateVersion": "0.0.0",
"dateTimeStamp": "Tue, 18 Oct 2016 08:08:06 GMT"
}
],
"translation": {
"translationDomain": "",
"supportedLanguages": "en,fr,de",
"defaultLanguage": "en",
"defaultI18NPropertyFile": "i18n.properties",
"resourceModelName": "i18n"
},
"basevalidator": {
"services": {
"xml": "fioriXmlAnalysis",
"js": "fioriJsValidator"
}
},
"codeCheckingTriggers": {
"notifyBeforePush": true,
"notifyBeforePushLevel": "Error",
"blockPush": false,
"blockPushLevel": "Error"
},
"mockpreview": {
"mockUri": "/sap/opu/odata/kernc/UI5STAT1_SRV/",
"metadataFilePath": "webapp/localService/UI5STAT1_SRV/metadata.xml",
"loadJSONFiles": false,
"loadCustomRequests": false,
"mockRequestsFilePath": ""
}
}
It seems like you are never instantiating a model.
You can do that in the manifest.json
"models": {
"i18n": {
"type": "sap.ui.model.resource.ResourceModel",
"settings": {
"bundleName": "Statusverwaltung.i18n.i18n"
}
},
"": {
"dataSource":"UI5STAT1_SRV"
}
},
"" defines the default model so you can use Bindingpaths like {/Stats}.

Resources