INIZIO VERS 3.0!!! OK Log!, ok test preliminare con IOB-WIN...

This commit is contained in:
Samuele E. Locatelli
2019-12-21 12:07:16 +01:00
parent 503f0f9cb9
commit bf28516c19
9 changed files with 3712 additions and 14 deletions
+3 -2
View File
@@ -5,7 +5,8 @@
</startup>
<appSettings>
<add key="checkPeriod" value="500" />
<!--<add key="targetExe" value="C:\tmp\IOB-WIN\IOB-WIN.exe" />
<add key="ArgsList" value="SIMUL_01,SIMUL_02,SIMUL_03,SIMUL_04" />-->
<add key="targetExe" value="C:\tmp\IOB-WIN\IOB-WIN.exe" />
<add key="ArgsList" value="SIMUL_01,SIMUL_02" />
<!--<add key="ArgsList" value="SIMUL_01,SIMUL_02,SIMUL_03,SIMUL_04" />-->
</appSettings>
</configuration>
+17
View File
@@ -32,9 +32,16 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.6.8\lib\net45\NLog.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Transactions" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
@@ -68,6 +75,16 @@
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="logs\.placeholder">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<Content Include="NLog.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="NLog.xsd">
<SubType>Designer</SubType>
</None>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
+15 -9
View File
@@ -11,7 +11,7 @@ namespace IOB_MAN
/// <summary>
/// Elenco ARGS (uno per child da avviare)
/// </summary>
public List<string> IobManList = new List<string>();
public List<string> ArgsList = new List<string>();
/// <summary>
/// Binding source degli elementi gestiti..
/// </summary>
@@ -29,6 +29,7 @@ namespace IOB_MAN
private void myInit()
{
utils.lgInfo("Starting App");
// gestione eventi binding source
ElencoIOB.AddingNew += ElencoIOB_AddingNew;
ElencoIOB.ListChanged += ElencoIOB_ListChanged;
@@ -40,25 +41,28 @@ namespace IOB_MAN
{
TargetExe = string.Format(@"{0}\Test.bat", Application.StartupPath);
}
string ArgsList = utils.CRS("ArgsList");
if (string.IsNullOrEmpty(ArgsList))
utils.lgInfo($"Target exe: {TargetExe}");
string ArgsString = utils.CRS("ArgsList");
utils.lgInfo($"Args found: {ArgsString}");
if (string.IsNullOrEmpty(ArgsString))
{
var rand = new Random();
// FAKE!! ne creo rand (5-15) di default...
// ne creo rand (5-15) di default...
for (int i = 0; i < rand.Next(5, 15); i++)
{
IobManList.Add("127.0.0.1");
ArgsList.Add("127.0.0.1");
}
}
else
{
var elenco = ArgsList.Split(',');
var elenco = ArgsString.Split(',');
foreach (var item in elenco)
{
IobManList.Add(item);
ArgsList.Add(item);
}
}
MainTimer.Start();
utils.lgInfo("Timer started");
}
private void ElencoIOB_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e)
@@ -95,7 +99,7 @@ namespace IOB_MAN
{
//Process childProc = new Process();
ProcessStartInfo psi = null;
foreach (var item in IobManList)
foreach (var item in ArgsList)
{
// da testare x aprire chiudere risorsa...
psi = new ProcessStartInfo
@@ -110,12 +114,14 @@ namespace IOB_MAN
// accodo nuovo IOB...
iobAdapt newIob = new iobAdapt();
DateTime adesso = DateTime.Now;
newIob.CodIOB = p.Id.ToString();
newIob.CodIOB = item;
newIob.startTime = adesso;
newIob.pID = p.Id;
newIob.isRunning = true;
// aggiungo a datasource
ElencoIOB.Add(newIob);
utils.lgInfo($"Avviato child process per {item} | pid: {p.Id}");
}
+83
View File
@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
autoReload="true"
throwExceptions="false"
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">
<!-- optional, add some variables
https://github.com/nlog/NLog/wiki/Configuration-file#variables
-->
<variable name="logDir" value="${basedir}/logs"/>
<!--
See https://github.com/nlog/nlog/wiki/Configuration-file
for information on customizing logging rules and outputs.
-->
<targets>
<!--
add your targets here
See https://github.com/nlog/NLog/wiki/Targets for possible targets.
See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers.
-->
<target xsi:type="File"
name="f_base"
fileName="${logDir}/${var:codApp:default=0000}/${shortdate}.log"
layout="${longdate} [${uppercase:${level}}] ${logger:shortName=true}|${message}"
archiveFileName="${logDir}/${var:codApp:default=0000}/${shortdate}.{###}.log"
archiveNumbering="Sequence"
archiveAboveSize="10240000"
maxArchiveFiles="60"
enableArchiveFileCompression="false"
keepFileOpen="false"
/>
<target xsi:type="File"
name="f_error"
fileName="${logDir}/${var:codApp:default=0000}/${shortdate}.log"
layout="${longdate} [${uppercase:${level}}] ${logger:shortName=true}|${message}${newline}${exception:format=tostring}"
archiveFileName="${logDir}/${var:codApp:default=0000}/${shortdate}.{###}.log"
archiveNumbering="Sequence"
archiveAboveSize="10240000"
maxArchiveFiles="60"
enableArchiveFileCompression="false"
keepFileOpen="false"
/>
<!--Target per asp.net 4.5+ (NON VA con 4.0 common-->
<!--<target xsi:type="File"
name="f"
fileName="${logDir}/${var:codApp:default=0000}/${shortdate}.log"
layout="${longdate} [${uppercase:${level}}] ${logger:shortName=true}|${message}|${exception:format=tostring}"
archiveFileName="${logDir}/${var:codApp:default=0000}/${shortdate}.{###}.zip"
archiveNumbering="Sequence"
archiveEvery="Day"
archiveOldFileOnStartup="true"
maxArchiveFiles="90"
enableArchiveFileCompression="true"
keepFileOpen="true"
/>-->
<!--<target name="fAsync" xsi:type="AsyncWrapper" queueLimit="5" overflowAction="Discard">
<target xsi:type="File"
keepFileOpen="true"
fileName="${basedir}/logs/${shortdate}_${var:codApp:default=0000}.log"
layout="${longdate}|${uppercase:${level}}|${var:codApp:default=0000}|${callsite}|${message}|${exception:format=tostring}"
archiveFileName="${basedir}/logs/${shortdate}_${var:codApp:default=0000}.{###}.zip"
archiveNumbering="Sequence"
archiveEvery="Day"
archiveOldFileOnStartup="true"
maxArchiveFiles="0"
enableArchiveFileCompression="true"
/>
</target>-->
</targets>
<rules>
<!-- add your logging rules here -->
<!--
Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f"
<logger name="*" minlevel="Debug" writeTo="f" />
-->
<logger name="*" minlevel="Debug" maxlevel="Warn" final="true" writeTo="f_base" />
<logger name="*" minlevel="Error" writeTo="f_error" />
</rules>
</nlog>
+3556
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -0,0 +1 @@

+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NLog" version="4.6.8" targetFramework="net461" />
<package id="NLog.Config" version="4.6.8" targetFramework="net461" />
<package id="NLog.Schema" version="4.6.8" targetFramework="net461" />
</packages>
+28
View File
@@ -1,4 +1,5 @@
using NLog;
using System;
using System.Collections.Generic;
using System.Configuration;
@@ -8,6 +9,33 @@ namespace IOB_MAN
{
public class utils
{
#region logging
/// <summary>
/// Classe logger
/// </summary>
public static Logger lg = LogManager.GetCurrentClassLogger();
/// <summary>
/// Effettua logging INFO corretto impostanto anche la variabile IOB prima di scrivere...
/// </summary>
/// <param name="txt2log"></param>
public static void lgInfo(string txt2log)
{
lg.Factory.Configuration.Variables["codApp"] = "IOB-MAN";
lg.Info(txt2log);
}
/// <summary>
/// Effettua logging ERROR corretto impostanto anche la variabile IOB prima di scrivere...
/// </summary>
/// <param name="txt2log"></param>
public static void lgError(string txt2log)
{
lg.Factory.Configuration.Variables["codApp"] = "IOB-MAN";
lg.Error(txt2log);
}
#endregion
/// <summary>
/// Helper formattazione durata human readable
/// </summary>
Vendored
+3 -3
View File
@@ -16,9 +16,9 @@ pipeline {
/* calcolo numero versione... diverso x branch MASTER/DEVELOP */
script {
withEnv(['NEXT_BUILD_NUMBER=611']) {
// env.versionNumber = VersionNumber(versionNumberString : '2.7.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true)
env.versionNumber = VersionNumber(versionNumberString : '2.7.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
withEnv(['NEXT_BUILD_NUMBER=613']) {
// env.versionNumber = VersionNumber(versionNumberString : '3.0.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true)
env.versionNumber = VersionNumber(versionNumberString : '3.0.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
env.APP_NAME = 'MAPO-IOB-WIN'
}
}