Commit Graph

197 Commits (f38f101aa28064026d3840bce9cf423c8f594e12)

Author SHA1 Message Date
NextTurn 5be8708701
Annotate WinSWCore for nullable reference types 2020-01-20 12:18:58 +08:00
NextTurn 3a7a332b84
Target .NET Framework 4.6.1 2020-01-19 21:14:19 +08:00
NextTurn cf396b718b
Publish single executable 2020-01-15 00:27:19 +08:00
NextTurn 492a4e3e42
Fix tests and update test framework 2020-01-15 00:07:44 +08:00
NextTurn eebc49d295
Fix an ancient bug 2020-01-14 20:11:47 +08:00
NextTurn bab17429d2
Improve RollingSizeTimeLogAppender 2020-01-14 19:44:12 +08:00
NextTurn 8864b676fb
Add new target frameworks 2020-01-14 19:26:26 +08:00
NextTurn b9089ab748
Remove unused variables 2020-01-14 14:05:04 +08:00
NextTurn 08bae2a682
Use built-in types 2020-01-14 14:05:03 +08:00
NextTurn 9808ae88e8
Clean up styles 2020-01-14 14:04:25 +08:00
NextTurn 6e9d25a7b5
Fix versioning 2020-01-13 14:39:16 +08:00
NextTurn afadf8f2b2
Fix tests 2020-01-13 14:39:14 +08:00
NextTurn 9634ddf0a9
Migrate to SDK-style projects 2020-01-13 14:10:57 +08:00
Oleg Nenashev 075be3f03d
Merge pull request #315 from mmatt1967/master
Prevent application crash when `roll-by-size-time` is enabled
2019-08-17 00:47:41 +02:00
Oleg Nenashev 831c7fbb7e
Merge pull request #321 from jeacott1/hidewindow
Add a new `hidewindow` option to suppress windows popup on legacy platforms
2019-08-17 00:44:38 +02:00
Ryan Rupp 502ed969fc Fix missing space in logging format 2019-08-13 23:30:53 -05:00
Ryan Rupp 47a3ca964a Fix duplicate startup logging 2019-08-13 16:54:13 -05:00
jeacott1 e2bf78f1df adds a <hidewindow>true</hidewindow> config switch
so that launching bat files on legacy machines
running Interactive Services Detection don't balk.
2019-05-28 13:25:17 +09:30
Pram 092b972617
Fix test for spelling 2019-05-20 19:26:06 +01:00
Mark Matthews e94e364a90 Fix issue #314 2019-04-29 12:08:05 +02:00
Dinz 9014f38b9c Added Support for the log appender roll-by-size-time to zip older files (#259)
* Introduced the following new elements.
1. logname - you can override the name of the log file rather than using the EXE name, this means you don't have to call your EXE a different name, just name the winsw exe different. Default's the name to the EXE as before.
2. outfiledisabled - you can disable writing to the out file. Defaults to false.
3. errfiledisabled - you can disable writing to the error file. Defaults to false.
4. outfilepattern - you can choose the pattern of the out file. Defaults to .out.log.
5. errfilepattern - you can choos the pattern of the error file. Defaults to .err.log.

* Downgraded from C#7.0 syntax.

* Applied reviewers comment

* not required

* removed the key

* Added unit test for new fields logname, outfiledisabled, errfiledisabled and errfilepattern.

Created a new appender called roll-by-size-time see class RollingSizeTimeLogAppender, this appender supports rolling by time and size and rolling at a specific time each day.

Added unit test for the new appender.

Added a new option testwait which is similar to test but waits for the user to press any key before calling the stop method.

* Update loggingAndErrorReporting.md

* Cannot use $ string.format syntax, downgraded code to string.format.

* Another syntax found of $

* Fixed a unit tests

* Added support to zip files.

* Added error handling

* Removed the zip call at startup.

* Fix issue with UTC

* Update loggingAndErrorReporting.md

Documented the new fields zipolderthannumdays and zipdateformat

* Update loggingAndErrorReporting.md

* Applied Code review

* Fixed a BST bug

* Added zip lib
2018-06-19 18:39:03 +02:00
Gabor Garancsi 56ab348652 Fix environment variable setting in RunawayProcessKiller test
This way the check can be reenabled as well.
2018-05-31 10:19:00 +02:00
Gerald Senarclens de Grancy f4da4bb8a8 pass ServiceDescriptor when creating wrapperservice 2017-10-30 13:36:17 +01:00
Oleg Nenashev 8d94277288 Issue #237 - Improve diagnostics of the Runaway Process Killer when it kills the process (#239)
* Issue #237 - Improve diagnostics of the Runaway Process Killer when it kills the process

* Issue #237 - Also print the process (not sure if it's safe)
2017-09-18 18:25:16 +02:00
Dinz 221d30f271 Introduced the following new elements. (#247)
* Introduced the following new elements.
1. logname - you can override the name of the log file rather than using the EXE name, this means you don't have to call your EXE a different name, just name the winsw exe different. Default's the name to the EXE as before.
2. outfiledisabled - you can disable writing to the out file. Defaults to false.
3. errfiledisabled - you can disable writing to the error file. Defaults to false.
4. outfilepattern - you can choose the pattern of the out file. Defaults to .out.log.
5. errfilepattern - you can choos the pattern of the error file. Defaults to .err.log.

* Downgraded from C#7.0 syntax.

* Applied reviewers comment

* not required

* removed the key

* Added unit test for new fields logname, outfiledisabled, errfiledisabled and errfilepattern.

Created a new appender called roll-by-size-time see class RollingSizeTimeLogAppender, this appender supports rolling by time and size and rolling at a specific time each day.

Added unit test for the new appender.

Added a new option testwait which is similar to test but waits for the user to press any key before calling the stop method.

* Update loggingAndErrorReporting.md

* Cannot use $ string.format syntax, downgraded code to string.format.

* Another syntax found of $

* Fixed a unit tests
2017-09-18 18:22:01 +02:00
Dos Moonen 0833d67c26 Start using stopTimeoutMs 2017-06-28 15:56:12 +02:00
Dos Moonen 138bca822d Noticed a small 'error' and fixed it 2017-06-27 09:58:04 +02:00
Oleg Nenashev 69857d5d8c Issue #218 - Also support managing Stdin, which is required in the main executable logic 2017-06-08 23:44:24 +02:00
Oleg Nenashev 05092376f3 Issue #218 - ProcessHelper#StartProcessAndCallbackForExit() should redirect STDOUT/STDERR when LogHandler is defined
It restores logging of executables, which has been broken in https://github.com/kohsuke/winsw/pull/220.
Not a regression, because the change has not been released yet
2017-06-08 22:54:44 +02:00
Paul Nikonowicz 5fb03bb094 [Issue #218] StdOut was not being redirected properly and was causing the child process to hang. 2017-05-30 17:32:25 -04:00
Oleg Nenashev 45f94fe006 [Issue #206] - Prevent printing of logs to the status command
This is rather a workaround to prevent printing of log messages in CLI with the default logging level. I reduced CLI logging verbosity to "Info" and moved the messages polluting the output to Debug. Anyway, these logging levels seem to be reasonable. I also added Info logging for start/stop/install/restart commands just to have a welcome message in CLI.
2017-04-26 00:35:28 +02:00
Oleg Nenashev 7d7000b1b9 Issue #148 - Update log4net to 2.0.8
It effectively bumps the bundled log4net version from 1.2.13 to 2.0.8 (log4net NuGet package used to have different versions).
According to the changelogs, there is no expected compatibility issues: https://logging.apache.org/log4net/release/release-notes.html
2017-04-23 13:41:18 +02:00
Oleg Nenashev d192c03638 #183 - Add core logic for the DelayedStart option support (#205)
* #183 - Add core logic for the DelayedStart option support

* #183 - Add unit tests

* #183 - Update documentation and the configuration sample

* #183 - Use API calls to set the DelayedAutoStart flag as @jtnord proposed

* #183 - Refactor the project to use `delayedAutoStart`
2017-04-18 23:23:52 +02:00
Oleg Nenashev 790b3a6541 Finalize the Download Command changes (#203)
* Refactor parameter parsing in Download.cs, add more checks

* Handle Download#unsecureAuth as boolean

* Parse Enums in a case-insensitive mode, propagate error correctly

* Add tests for the newly introduced functionality

* Update the configuration sample to reflect the recent changes

* Update the sample text according to the proposal from @nightman68
2017-04-13 16:49:59 +02:00
Oleg Nenashev f0770a0e15 Introduce the Download#FailOnError option. (#195)
* Introduce the Download#FailOnError option.

The change also adds logging of download operations to the wrapper log

* Add documentation for the failOnError flag
2017-04-11 22:57:39 +02:00
Torsten 5803d3ce15 Add support of authentication in the download operation (#194)
Issue #126 - Add support of authentication in the download settings
2017-04-11 22:37:44 +02:00
Oleg Nenashev 5637c406aa ExtensionTestBase should provide public methods within the test class 2017-03-31 17:01:42 +02:00
Oleg Nenashev 8cd58531f6 [JENKINS-42744] - Just another proof that some testing coverage is required for the service management logic 2017-03-31 16:01:01 +02:00
Oleg Nenashev f81f5d3c57 [FIXED JENKINS-42744] - Do not inject ps.EnvironmentVariables explicitly 2017-03-31 15:36:56 +02:00
Oleg Nenashev 9cfdcf4ae7 [JENKINS-42744] - Allow ignoring the WINSW_SERVICE_ID env variable (test-only for now) 2017-03-31 15:28:02 +02:00
Oleg Nenashev bca9bafc66 [JENKINS-42744] - Improve the ProcessHelperTes, add RunawayProcessKillerTest for the affected logic 2017-03-31 15:10:57 +02:00
Oleg Nenashev 9fc518a3d0 [JENKINS-42744] - Reproduce the issue in the unit test 2017-03-31 13:02:53 +02:00
Oleg Nenashev 615519f6a3 [JENKINS-42744] - Decouple the process start logic to a separate method in the helper class 2017-03-31 12:06:36 +02:00
madargs de83539bef Fixes #95 - Service not sending SIGINT properly to java (#186)
* Fixes #95 - Service not sending SIGINT properly to java

Detach from console process after sending SIGINT to java.
Note: we still need <stopparentprocessfirst> to be set to true, so the
parent (java) process is shut down first.
Moved exception handling to GetChildPids.
StopProcessAndChildren now gets a fresh list of childPids after stopping
a parent process, as that may have caused some child processes to
terminate.

* Fixes #181 - V2 : WinSW.NET2.exe not working

Latest version of ILMerge targets .NET4 by default when merging
assemblies; specify target platform version for the .NET2 executable.

* Fixes #95 - Service not sending SIGINT properly to java

Error-checking for console detach, spaces indentation.
#181 fix moved to separate branch.

Revert "Fixes #181 - V2 :
WinSW.NET2.exe not working"

This reverts
commit
a089755cb9.
2017-02-13 18:24:23 +03:00
madargs ac7a8b6f99 Issue #181 - WinSW.NET2.exe - ILMerge should explicitly define v2 as a TargetPlatformVersion (#188)
* Fixes #95 - Service not sending SIGINT properly to java

Detach from console process after sending SIGINT to java.
Note: we still need <stopparentprocessfirst> to be set to true, so the
parent (java) process is shut down first.
Moved exception handling to GetChildPids.
StopProcessAndChildren now gets a fresh list of childPids after stopping
a parent process, as that may have caused some child processes to
terminate.

* Fixes #181 - V2 : WinSW.NET2.exe not working

Latest version of ILMerge targets .NET4 by default when merging
assemblies; specify target platform version for the .NET2 executable.

* Revert "Fixes #95 - Service not sending SIGINT properly to java"

This reverts commit dc42c73fab.
2017-02-13 18:24:07 +03:00
Oleg Nenashev d665afc91c Fix #178 - Use proper default value when handling Arguments 2017-01-04 23:15:42 +01:00
Oleg Nenashev b27c523f0a Issue #178 - Add unit tests for argument ant arguments config entries 2017-01-04 23:14:49 +01:00
Oleg Nenashev 9399544ef5 Fix #159 - Streamline TimeSpan parsing logic, get rid of the buggy code 2016-12-29 11:02:24 +01:00
Oleg Nenashev fca428d351 Issue #159 - reproduce issue in tests 2016-12-29 10:49:42 +01:00
Oleg Nenashev 806c945d65 Issue #159 - Add tests for TimeSpan fields 2016-12-29 00:13:56 +01:00
Oleg Nenashev 9181894e52 Add A ConfigXmlBuilder test utility class 2016-12-29 00:13:17 +01:00
Oleg Nenashev 098046c8e1 Merge pull request #173 from oleg-nenashev/bug/Issue_54_EnvVars_IN_EventLog
Fixes #54. Do not dump WinSW environment variables to the Event log
2016-12-27 17:16:59 +01:00
Oleg Nenashev 852b8b61e1 Merge pull request #172 from oleg-nenashev/Issue_59_SystemShutdownOnProcessKill
Issue #59 - Prevent failure when Child processes cannot be retrieved due to the system shutdown
2016-12-27 17:16:50 +01:00
Oleg Nenashev ece313e28e Merge pull request #170 from oleg-nenashev/sample-config-file
Provide WinSW configuration samples
2016-12-27 17:16:38 +01:00
Oleg Nenashev d702f9eefe Fixes #54. Do not dump WinSW environment variables to the Event log 2016-12-24 21:56:51 +01:00
Oleg Nenashev 10bcbde081 Issue #59 - Prevent failure when Child processes cannot be retrieved due to the system shutdown 2016-12-24 21:40:57 +01:00
Oleg Nenashev d28e6f3c60 Issue #170: Enable publishing of samples as AppVeyor artifacts 2016-12-23 22:47:05 +01:00
Oleg Nenashev 47716160d9 Issue #170 - Also provide a minimal configuration file 2016-12-23 22:43:40 +01:00
Oleg Nenashev ef0d9f6aca Issue #170 - Adjust the configuration example file name 2016-12-23 22:34:02 +01:00
Oleg Nenashev c0d2d0b6e3 Tests: Add ExamplesTests and fix the issues in the code 2016-12-23 22:30:15 +01:00
Oleg Nenashev 4db3266125 Tests: Add the ServiceDescriptorAssert class.
The class provides basic logic for analyzing parameters
2016-12-23 22:29:24 +01:00
Oleg Nenashev 67bfc6bcd2 Fix #171 - Handle stopexecutable as an optional property in ServiceDescriptor
Tests will be pushed later
2016-12-23 22:24:24 +01:00
Oleg Nenashev 14f32cd309 Decouple Default Settings to a separate publicly accessible class.
Required for tests.
2016-12-23 21:18:59 +01:00
Oleg Nenashev 413e24ebeb Remove the obsolete configuration sample from the ServiceWrapper project 2016-12-23 12:54:59 +01:00
Oleg Nenashev ab51b50d85 Issue #85 - Get rid of the deprecated FileHandle API (#167) 2016-12-22 23:40:44 +01:00
iforapsy 28917c44d6 Do not propagate exceptions from Process.Kill() if the process actually exits (#166)
* Ignore more exceptions from Process.Kill()

Sometimes we get an InvalidOperationException when we kill a process that is already dead and other times we get a Win32Exception. Let's ignore all exceptions from killing a process if it has exited.

* Fix key name typo in README.md

The name of the key has an underscore, not a hyphen.
2016-12-20 15:20:08 +01:00
Oleg Nenashev 3c6d8e2765 Issue #146 - Improve logging of the Uninstall Operation.
This change does not change the behavior (return code, etc.) of the WinSW logic, but on the other hand it provides diagnostic information.
2016-12-14 18:16:56 +01:00
Oleg Nenashev e0668a2530 Move pom.xml to the top level, use GitHub releases as a source 2016-12-10 02:07:42 +01:00
Oleg Nenashev 12c16e40a7 Logging subsystem refactoring - use log4net (#145)
* Save the progress

* Add log4net Log appender for Windows service events

* Get rid of the IEventLogger API, we use log4net now
2016-12-09 01:41:20 +01:00
Oleg Nenashev 5041de60a1 Merge pull request #143 from oleg-nenashev/config-error-handling
Improve handling of initialization errors
2016-12-09 01:19:55 +01:00
Oleg Nenashev f58b287278 Streamline assembly versions (#153)
* Align all component versions to 2.0.*
* Enable patching of assemblies in AppVeyor

* Fix the slash

* And escaping...
2016-12-06 23:54:37 +01:00
Oleg Nenashev f21f82dfc0 Rename executables being generated during the build 2016-12-06 23:21:21 +01:00
Oleg Nenashev 109e34045a Delete app.config from the ServiceWrapper_dotNET4 project 2016-12-04 12:33:06 +01:00
Oleg Nenashev 191040a890 .NET4 - Create a new binary project for the WinSW .NET4 binary 2016-12-04 12:07:48 +01:00
Oleg Nenashev 6c0f6d1f7a Fixes #142 - Deploy the automatic build on Appveyor (#144)
* First configuration stub

* Get rid of the old winsw_cert.pfx references, adjust docs

* Fix the corrupted log4net reference, we use 2.0.3

* Generate stub SNK file

* Signing: Try full SDK path to generate SNKs

* Fix the path

* Signing: Sign all assemblies being packed into WinSW

* Tests: Try enabling tests

* Tests and artifacts: Use absolute paths

* Artifact path must be relative

* The test DLL is the NUnit one

* nunit-console does not require loggers

* NUnit: Try picking all DLLs in the output folder

* NUnit console: No wildcards

* Tests: Fix the test project to make it properly working with the new project structure

* Docs: Clarify the specifics of external extension usage

* Add AppVeyor badge to README.md
2016-12-04 09:34:19 +01:00
Oleg Nenashev 871afa0f2c Generalize top-level logging. All exceptions will be written to loggers 2016-12-03 15:40:20 +01:00
Oleg Nenashev 641adb4e0a Extension configuration failure should be logged as fatal 2016-12-03 15:11:24 +01:00
Oleg Nenashev 62b495f088 Merge pull request #133 from oleg-nenashev/processTerminationOnStartup
[Issue #125] Runaway process termination on startup
2016-12-01 08:03:27 +01:00
Oleg Nenashev 92367f44ef RunawayProcessKillerExtension: Check if the environment variable refers service Id before terminating it 2016-11-30 12:37:07 +01:00
Oleg Nenashev 5e835479ae Generalize usage of System environment variables for processes 2016-11-30 12:36:03 +01:00
Oleg Nenashev 2a07f6af5d Address another Milliseconds misusage (similar to #124) 2016-11-26 23:18:03 +01:00
Oleg Nenashev dfafc2790d [Issue #124] - Prevent the CPU overutilization due to the usage of Milliseconds instead of TotalMsec 2016-11-26 23:16:33 +01:00
Oleg Nenashev 0a59da5f98 [Issue #125] - Introduce the RunawayProcessKiller extension 2016-11-26 22:35:34 +01:00
Oleg Nenashev 24a5e93b67 Decouple Some process management logic to a standalone ProcessHelper class 2016-11-26 21:37:53 +01:00
Oleg Nenashev 535e8429e0 Add extension point for tracking process startup and termination in extensions 2016-11-26 20:43:39 +01:00
Oleg Nenashev 80295db8d7 Merge branch 'master' into winsw-2.0
Conflicts:
	winsw.csproj
2016-11-10 13:25:42 +01:00
Oleg Nenashev e24ef76aa0 Fixed the extension classname in the SharedDirectoryMapper example 2015-06-25 15:38:35 +01:00
Oleg Nenashev 53ba5810a6 Strong name signing of merged assemblies.
The initial implementation was generating unsigned assemblies. ServiceWrapper/winsw.csproj has been reworked to sign merged all assemblies automatically.
The current implementation requires winsw_key.snk instead of the encrypted key with a password.

Signed-off-by: Oleg Nenashev <o.v.nenashev@gmail.com>
2015-02-08 14:28:16 +03:00
Oleg Nenashev fb8dd8a15f Merge log4net.dll into the output DLL
Signed-off-by: Oleg Nenashev <o.v.nenashev@gmail.com>
2015-02-08 14:28:15 +03:00
Oleg Nenashev 1f6542e171 saved the progress
Signed-off-by: Oleg Nenashev <o.v.nenashev@gmail.com>
2015-02-08 14:28:15 +03:00
Oleg Nenashev 8a5a1dd10d Integrate log4net dependency into WinSWCore
Signed-off-by: Oleg Nenashev <o.v.nenashev@gmail.com>
2015-02-08 14:28:15 +03:00
Oleg Nenashev 3af1f72658 Support merging plugins into winsw.exe executable
* Decouple Core components into WinSWCore projects.
* Use ILMerge to merge everything (inc. Plugins) into a single executable

TODO: API Should be refactored before the publishing
TODO: check signing procedure

Signed-off-by: Oleg Nenashev <o.v.nenashev@gmail.com>

Conflicts:
	src/Core/ServiceWrapper/winsw.csproj

Conflicts:
	src/Core/ServiceWrapper/Main.cs
	src/winsw.sln
2015-02-08 14:28:15 +03:00
Oleg Nenashev 2546168ed3 Integrate changes in WinSW core and SharedDirectoryMapper from #42
The code is compilable, the SharedDirectoryMapper won't be included into WinSW

Signed-off-by: Oleg Nenashev <o.v.nenashev@gmail.com>

Conflicts:
	src/Core/ServiceWrapper/Main.cs

Conflicts:
	src/Core/ServiceWrapper/ServiceDescriptor.cs
	src/Test/winswTests/winswTests.csproj
	src/winsw.sln
2015-02-08 13:53:26 +03:00
Oleg Nenashev 4a2249d30c Merge branch 'master' into winsw-2.0
Conflicts:
	src/Core/ServiceWrapper/Main.cs
	src/Test/winswTests/winswTests.csproj

Signed-off-by: Oleg Nenashev <o.v.nenashev@gmail.com>
2015-02-08 13:44:30 +03:00
Oleg Nenashev 98268b24cc Integrate log4net into WinSW, migrate wrapper.log engine
TODOs:
    Migrate EventLogs to log4net
    Delegate exceptions handling to log4net
    Allows setting up log levels from ServiceDescriptor
    (?) Migrate STDERR/STDOUT logs to log4net
    (?) Support XML configurations of log4net loggers

Related to #69

Signed-off-by: Oleg Nenashev o.v.nenashev@gmail.com
Signed-off-by: Oleg Nenashev <o.v.nenashev@gmail.com>
2015-02-02 10:41:54 +03:00
Oleg Nenashev 912e6ddd4f [FIXED #72] - Rework the solution to use NuGet package manager
* Use NuGet to retrieve package dependencies. Resolves #72
* Get rid of the built-in NUnit library in winswTests

Signed-off-by: Oleg Nenashev <o.v.nenashev@gmail.com>
2015-01-31 15:12:46 +03:00
Oleg Nenashev 51d1a8e8af Rework the project structure.
* move WinSW core to a separate folder
* create scr on the top level to store all the stuff inside
Related to #66

Signed-off-by: Oleg Nenashev <o.v.nenashev@gmail.com>
2015-01-31 14:40:52 +03:00