qima / log4go Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/log4go
License: BSD 2-Clause "Simplified" License
Automatically exported from code.google.com/p/log4go
License: BSD 2-Clause "Simplified" License
Please see http://log4go.googlecode.com/ Installation: - Run `goinstall log4go.googlecode.com/hg` Usage: - Add the following import: import l4g "log4go.googlecode.com/hg" Acknowledgements: - pomack For providing awesome patches to bring log4go up to the latest Go spec
Tip needs updated to reflect spec changes for latest stable release. Fix is
attached as an exported series of diffs after gofix was applied to tip.
Original issue reported on code.google.com by [email protected]
on 5 Jun 2011 at 6:01
Attachments:
Make.$(GOARCH) has been replaced with Make.inc. varargs must now be passed as
args...
Original issue reported on code.google.com by [email protected]
on 4 Oct 2010 at 5:02
Attachments:
The LICENSE file states All rights reserved but then puts the code under a free
license.
How does that fit together?
Wouldn't the author have to NOT reserve all rights and put his contributions
under the license?
Original issue reported on code.google.com by [email protected]
on 8 Jun 2011 at 3:28
It's currently impossible to maintain references to log4go level values outside
the package.
For example, I want to have the log level configurable through a flag. To do
this I map a symbolic name like "info" to a numeric integer level. With no
ability to reference the level type, this is impossible.
Patch attached.
Original issue reported on code.google.com by [email protected]
on 10 Jul 2012 at 6:36
Attachments:
Gofix for weekly.2011.12.22
Updates for new time.Time
Original issue reported on code.google.com by [email protected]
on 24 Dec 2011 at 12:06
Attachments:
fix typo
Original issue reported on code.google.com by [email protected]
on 3 Jun 2011 at 9:54
Attachments:
What steps will reproduce the problem?
I do not have a specific steps to reproduce the issue because it occurs in a
very complicated project which I cannot share.
Sometimes the l4g won't output the error/debug messages to StdOut or whatever
file I redirect the stream to
But if I add a fmt.Println("whatever text"), the error will appear in the
output.
I tried to call l4g.Close(), but it doesn't help.
I think it might be buffer flush issues.
Could you please check?
Original issue reported on code.google.com by [email protected]
on 7 May 2012 at 5:19
Fixes strings.Split usage
Original issue reported on code.google.com by [email protected]
on 13 Aug 2011 at 11:53
Attachments:
There is really no reason to have both of them, as one is essentially a
superset of the other. For now, FormatLogWriter isn't documented, and I'll
keep it that way until it is merged.
Original issue reported on code.google.com by [email protected]
on 20 Jun 2010 at 8:01
What steps will reproduce the problem?
1. general code:
import log "code.google.com/p/log4go"
log.Error(err)
os.Exit(-1)
2.
3.
What is the expected output? What do you see instead?
os.Exit(-1) make the process exit, but the 'err' don't be writed into log file.
the 'err' may be buffered by the chan of 'log4go', os.Exit make the log4go
writer(goroutine) exit too.
What version of the product are you using? On what operating system?
lastest, Linux amd64
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 10 Oct 2012 at 3:17
$ hg log -p -r 49
changeset: 49:c177575d6b20
tag: tip
user: Fredrik Ehnbom <[email protected]>
date: Wed Apr 17 10:45:22 2013 +0200
summary: Fix for a data race found with Go 1.1's new race detector
http://tip.golang.org/doc/articles/race_detector.html
diff -r c3294304d93f -r c177575d6b20 pattlog.go
--- a/pattlog.go Sat Feb 25 12:58:10 2012 -0800
+++ b/pattlog.go Wed Apr 17 10:45:22 2013 +0200
@@ -3,9 +3,10 @@
package log4go
import (
+ "bytes"
"fmt"
- "bytes"
"io"
+ "sync"
)
const (
@@ -21,6 +22,7 @@
}
var formatCache = &formatCacheType{}
+var formatMutex sync.Mutex
// Known format codes:
// %T - Time (15:04:05 MST)
@@ -43,7 +45,9 @@
out := bytes.NewBuffer(make([]byte, 0, 64))
secs := rec.Created.UnixNano() / 1e9
+ formatMutex.Lock()
cache := *formatCache
+ formatMutex.Unlock()
if cache.LastUpdateSeconds != secs {
month, day, year := rec.Created.Month(), rec.Created.Day(), rec.Created.Year()
hour, minute, second := rec.Created.Hour(), rec.Created.Minute(), rec.Created.Second()
@@ -55,8 +59,10 @@
longTime: fmt.Sprintf("%02d:%02d:%02d %s", hour, minute, second, zone),
longDate: fmt.Sprintf("%04d/%02d/%02d", year, month, day),
}
+ formatMutex.Lock()
cache = *updated
formatCache = updated
+ formatMutex.Unlock()
}
// Split the string into pieces by % signs
Original issue reported on code.google.com by [email protected]
on 17 Apr 2013 at 8:47
It would be better if the source code were into a directory with a name ready
to import.
So, instead of:
import l4g "log4go.googlecode.com/svn/stable"
we could use it directly from:
import "log4go.googlecode.com/svn/l4g"
Original issue reported on code.google.com by [email protected]
on 3 Jul 2010 at 8:58
What steps will reproduce the problem?
0. Logging is set up as follows:
var (
logger = make(l4g.Logger)
)
type Logger struct {
}
func (l *Logger) Write(d []byte) (int, error) {
s := string(d)
logger.Info(s)
return len(d), nil
}
func init(){
log.SetFlags(0)
log.SetOutput(&Logger{})
// host, port are non-local btw
logger.AddFilter("network", l4g.FINEST, l4g.NewSocketLogWriter("udp", fmt.Sprintf("%s:%d", host, port)))
}
1. Start a udp socket logger in process A to a process B ( as above )
2. Start logging in A
logger.Info(s)
3. Stop B
What is the expected output? What do you see instead?
Expected:
That logging in A continues as normal. but nothing reach B ( as it is down )
Instead:
All goroutines that do any logging end up hanging like this:
goroutine 75334584 [semacquire]:
sync.runtime_Semacquire(0xc21001f194)
/usr/local/go/src/pkg/runtime/sema.goc:199 +0x30
sync.(*Mutex).Lock(0xc21001f190)
/usr/local/go/src/pkg/sync/mutex.go:66 +0xd6
log.(*Logger).Output(0xc21001f190, 0x2, 0xc2102649c0, 0x1c, 0x0, ...)
/usr/local/go/src/pkg/log/log.go:134 +0x95
log.Printf(0x7f8e90, 0x16, 0x7f2b541c7eb8, 0x1, 0x1)
/usr/local/go/src/pkg/log/log.go:276 +0x7d
while a single goroutine hangs on:
code.google.com/p/log4go.SocketLogWriter.LogWrite(0xc210068420, 0xc2109e5c40)
.../lib/src/code.google.com/p/log4go/socklog.go:17 +0x3a
code.google.com/p/log4go.Logger.intLogf(0xc2101baab0, 0x4, 0xc2102a7cd0, 0x48,
0x0, ...)
.../lib/src/code.google.com/p/log4go/log4go.go:223 +0x3aa
code.google.com/p/log4go.Logger.Info(0xc2101baab0, 0x69dbe0, 0xc210357540, 0x0,
0x0, ...)
.../lib/src/code.google.com/p/log4go/log4go.go:405 +0x142
main.(*Logger).Write(0xbafcc8, 0xc210181600, 0x48, 0x100, 0xba6f80, ...)
.../lib/src/redistasker/deleter/logger.go:24 +0x94
log.(*Logger).Output(0xc21001f190, 0x2, 0xc2102a7230, 0x47, 0x0, ...)
/usr/local/go/src/pkg/log/log.go:153 +0x405
log.Printf(0x8168d0, 0x1d, 0x7f2b541cbf60, 0x3, 0x3)
This is because the goroutine that reads from the channel and writes to the
socket has returned.
Its probably the same for a tcp socket. I've only tested udp though
Original issue reported on code.google.com by Kimmeh
on 23 Jan 2014 at 2:15
Is there any official plan to move this repository to Github?
Original issue reported on code.google.com by [email protected]
on 17 Mar 2015 at 6:09
diff -r 0f96d5ad1243 log4go_test.go
--- a/log4go_test.go Sat Aug 13 15:35:26 2011 -0700
+++ b/log4go_test.go Thu Oct 06 14:25:26 2011 +0200
@@ -438,7 +438,7 @@
if err != nil {
panic(err)
}
- if err := syscall.Dup2(sink.Fd(), syscall.Stdout); err != 0 {
+ if _,err := syscall.Dup2(sink.Fd(), syscall.Stdout); err != 0 {
panic(os.Errno(err))
}
Original issue reported on code.google.com by [email protected]
on 6 Oct 2011 at 12:32
Log4j has awesome formatting feature, why not log4go? The formatting in log4go
is really strict, for instance, I don't want to see the timezone but I want to
see the second and millisecond info, but I cannot do this. Can it be a little
flexible?
Original issue reported on code.google.com by [email protected]
on 24 Jun 2014 at 1:10
In new 2.0 version, just as stated LogWriter is a channel, and a new go-routine
is spawned to manage the printing.
But when a main program exited too quickly before that go-routine can finish
processing the logs from channel, then these logs will be lost. Even
logger.Close() won't resolve this.
Need some extra synchronization codes maybe, like embed a feedback channel
inside the type LogWriter so logWriter.Close() can exam this channel and wait
until all logs are printed.
Original issue reported on code.google.com by [email protected]
on 22 Sep 2011 at 1:57
Version/System Details
======================
GoLang version 1.0.3
OS: Issue on Windows 7 and Debian linux
log4go version 3.0.1
Issue Description
=================
I have a fairly simple app that needs only one log file and I have defined my
log4ggo configuration as follows:
<logging>
<filter enabled="false">
<tag>stdout</tag>
<type>console</type>
<!-- level is (:?FINEST|FINE|DEBUG|TRACE|INFO|WARNING|ERROR) -->
<level>DEBUG</level>
</filter>
<filter enabled="true">
<tag>AppLog</tag>
<type>file</type>
<level>DEBUG</level>
<property name="format">[%D %T] [%L] (%S) %M</property>
<property name="filename">app/log/main.log</property>
<property name="rotate">false</property> <!-- true enables log rotation, otherwise append -->
<property name="maxsize">5M</property> <!-- \d+[KMG]? Suffixes are in terms of 2**10 -->
<property name="maxlines">0K</property> <!-- \d+[KMG]? Suffixes are in terms of thousands -->
<property name="daily">false</property> <!-- Automatically rotates when a log message is written after midnight -->
</filter>
</logging>
This creates the log file, it creates only one file and does not generate new
files when the thresholds are met. You will see that I have rotate set to
false. If I set
<property name="rotate">true</property> <!-- true enables log rotation, otherwise append -->
then the application when running writes every log line to a new file.
Eventually it crashes as it has written so many log files it cannot generate a
new unique log number this happens after main.log.999
What I would like is to keep a set of say 10 log files that are max size 5MB;
in the same way the log4j works for Java.
Thanks for writing this library and making it available, on the whole it is an
excellent package, thanks for you r efforts on it.
Original issue reported on code.google.com by [email protected]
on 7 Mar 2013 at 10:11
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.