Commit Graph

40 Commits

Author SHA1 Message Date
Todd Beets
349e718d39 Changes for max log files option (active plus backups); remove redundant lexical sort of backups; adjust test 2023-09-15 22:08:09 -07:00
Todd Beets
46147cf0ea Add logfile_max_archives feature and test. 2023-09-15 16:21:51 -07:00
Neil Twigg
e88517c90e Add logtime_utc option
backport to main: https://github.com/nats-io/nats-server/pull/3833

Signed-off-by: Waldemar Quevedo <wally@nats.io>
2023-07-21 16:56:13 -07:00
Marco Primi
f8a030bc4a Use testing.TempDir() where possible
Refactor tests to use go built-in temporary directory utility for tests.

Also avoid binding to default port (which may be in use)
2022-12-12 13:18:44 -08:00
Ivan Kozlovic
3c9a7cc6e5 Move to Go 1.19, remote io/util, fix data race and a flapper
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-08-05 09:55:37 -06:00
Ivan Kozlovic
f805f23d6e Travis updates
- Add Go 1.17
- Fix go fmt from Go 1.17 (build directives)
- Download version of misspell and staticcheck instead of doing
"go get" since current staticcheck would be broken without go.mod

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-11-15 17:23:08 -07:00
Jaime Piña
d929ee1348 Check errors when removing test directories and files
Currently in tests, we have calls to os.Remove and os.RemoveAll where we
don't check the returned error. This hides useful error messages when
tests fail to run, such as "too many open files".

This change checks for more filesystem related errors and calls t.Fatal
if there is an error.
2021-04-07 11:09:47 -07:00
Jaime Piña
e44275b963 Consolidate temporary test files and directories
Currently, temporary test files and directories are written in lots of
different paths within the OS's temp dir. This makes it hard to know
which files are from nats-server and which are unrelated. This in turn
makes it hard to clean up nats-server test files.
2021-04-06 10:42:55 -07:00
Paolo Teti
e148c540e2 [FIXED]: syslog Warnf call Notice() instead of Warning()
Use Warning() instead of Notice() and fix documentation for both
syslog and Windows event log.

Signed-off-by: Paolo Teti <paolo.teti@gmail.com>
2021-01-03 16:28:09 +01:00
Ivan Kozlovic
947798231b [UPDATED] TCP Write and SlowConsumer handling
- All writes will now be done by the writeLoop, unless when the
  writeLoop has not been started yet (likely in connection init).
- Slow consumers for non CLIENT connections will be reported but
  not failed. The idea is that routes, gateway, etc.. connections
  should stay connected as much as possible. However if a flush
  operation times out and no data at all has been written, the
  connection will be closed (regardless of type).
- Slow consumers due to max pending is only for CLIENT connections.
  This allows sending of SUBs through routes, etc.. to not have
  to be chunked.
- The backpressure to CLIENT connections is increased (up to 1sec)
  based on the sub's connection pending bytes level.
- Connection is flushed on close from the writeLoop as to not block
  the "fast path".

Some tests have been fixed and adapted since now closeConnection()
is not flushing/closing/removing connection in place.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-12-31 15:06:27 -07:00
Ivan Kozlovic
1930159087 Merge pull request #1202 from nats-io/add_log_size_limit
[ADDED] LogSizeLimit option
2019-11-21 19:11:08 -07:00
Ivan Kozlovic
e9a134ac48 [ADDED] LogSizeLimit option
Allow auto-rotation of log files when the size is greater than
configured limit.
The backup files have the same name than the original log file
name with the following suffix:

<log name>.yyyy.mm.dd.hh.mm.ss.micros

where:
- yyyy   is the year
- mm     is the month
- dd     is the day
- hh     is the hour
- mm     is the minute
- ss     is the second
- micros is the number of microseconds (to help avoid duplicates)

Resolves #1197

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-11-21 15:26:33 -07:00
Ivan Kozlovic
63138509f7 Tune some code/test for Windows
Running test suite on a Windows VM, I notice several failures.
Updated the compute of the RTT to be at least 1ns. I think that
this is just an issue with the VM I am running, but that change
will have no impact for normal situations (since setting the rtt
to the very minimum duration (1ns) instead of 0) and will prevent
some tests from failing.

Because of those same timer granularity issues, I had to add some
delays between some actions in order for time.Sub()/Since() to
actually report something more than 0.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-11-21 14:32:46 -07:00
Andy Xie
f77bdfd0bd add log date field check 2019-06-28 20:07:29 +08:00
Derek Collison
d7140a0fd1 Update for client rename
Signed-off-by: Derek Collison <derek@nats.io>
2019-05-10 15:11:30 -07:00
aviau
35b4eaf4ad chmod -x logger/syslog_windows_test.go 2018-11-21 11:39:27 -05:00
Derek Collison
47963303f8 First pass at new cluster design
Signed-off-by: Derek Collison <derek@nats.io>
2018-10-24 21:29:29 -07:00
Waldemar Quevedo
5e3950df0a Add Warnf to logger interface
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2018-09-10 14:50:48 -07:00
Ivan Kozlovic
2153a45050 Update service and syslog code to use variable instead of constant
for the process name and service name. This allows the reuse of this
code in NATS Streaming Server by invoking the new setters to
change the service and process names.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2018-08-16 10:21:01 -06:00
Derek Collison
00901acc78 Update license to Apache 2 2018-03-15 22:31:07 -07:00
Colin Sullivan
508ce2bcf3 implement io.Closer interface in the logger 2018-03-13 19:08:45 -06:00
Colin Sullivan
182be3feb9 Close files on reload. 2018-03-13 15:31:45 -06:00
Ivan Kozlovic
9cddf0fcdf [FIXED] Windows Docker Image
The use of the `svc` API prevented the NATS Server to run as
a container on both nanoserver and windowsservercore Docker images.
An attempt was made to replace svc.Debug with normal server.Start()
if detected to be interactive, however, that did not work. The
fact of detecting if interactive or not already requires connecting
to the service controller apparently.
This change looks up for an environment variable (NATS_DOCKERIZED)
and if set to "1", will not make use of the `svc` package.
This environment variable will be set in the Docker image (in
nats-docker/windows/nanoserver/Dockerfile and windowsservercore/Dockerfile).

Resolves #543
2017-07-18 19:00:17 -06:00
Colin Sullivan
6e9e491c79 Updates for running in a windows container environment.
* Fixes unit tests running in windows containers with the default configuration.
2017-01-09 10:07:24 -07:00
Colin Sullivan
1df5af0491 Implement windows event logging 2016-12-29 13:53:58 -07:00
Colin Sullivan
c3753d4d27 Generate syslog tag based on executable/link name 2016-10-18 12:50:49 -06:00
Ivan Kozlovic
dc906fdd89 Add code coverage for File logger 2016-04-22 17:00:13 -06:00
Derek Collison
fc3e345eb2 gosimple fixes 2016-03-31 07:34:13 -07:00
Colin Sullivan
2baac47820 Address issues found by golint.
* No functional changes
* Did not address the ALL_CAPS issues
* Did not modify public APIs and field names.
2016-03-15 15:21:13 -06:00
Derek Collison
58c7ded5d3 Make FATAL red too 2015-01-09 19:11:41 -08:00
Derek Collison
b2eca2ced4 pid prefix optional, fixup tests 2015-01-09 19:02:56 -08:00
Derek Collison
eaf20c2667 minor updates 2015-01-09 18:46:31 -08:00
Derek Collison
c513bdd89a Log modifications
Several modifications, added [pid] prefix to loggers, changed classifications to 3 characters only, and turn off colors if being redirected to a file.
2015-01-09 18:44:53 -08:00
Máximo Cuadros Ortiz
8a1a1925c8 fixing fatalf behaviour 2014-11-25 23:21:35 +01:00
Raffaele Sena
5e58383a32 There is no log/syslog package for windows. Providing a dummy syslogger
(but actually it logs to stdout)
2014-11-24 07:51:35 -08:00
Ken Robertson
5623b583a9 Updates for new logging to appease govet
Govet doesn't like functions that look like format handlers not ending in `f`,
such as Debug() vs Debugf(). This is changing some of the new log handling to
use 'f' function names to appease govet.

Updated the implicit handling of including the client as an arg without being
used in a format string. Now the client object simply has a Errorf function
for logging errors and it adds itself onto the format string.
2014-10-29 11:32:14 -07:00
Máximo Cuadros Ortiz
7c7578ae38 Notice and Logger messages 2014-10-16 01:16:21 +02:00
Máximo Cuadros Ortiz
d99c6aeead remote syslog support 2014-10-16 00:45:44 +02:00
Máximo Cuadros Ortiz
6586ac4653 better client identification at logs and some performances improves 2014-10-16 00:44:56 +02:00
Máximo Cuadros Ortiz
96d044dce4 login system abstraction 2014-10-16 00:44:22 +02:00