Xen wrote:
Per Jessen schreef op 10-04-16 10:19:
The difference is they call him king, the difference frightens me.
What I mean is very simple, and you already know the answer.
1. Anything you write yourself you will have to write from scratch if you cannot reuse someone else's code. 2. This will take a lot of energy and is less efficient than reusing existing code if you agree with that code.
In principle this is absolutely true, in practice for a write2log() call, less so. Unless that call was part of a framework I wanted to use in my application anyway, I would not bother. It would take me less time to write my own than to learn how to use a foreign one.
Probably, but that depends on how complex those other ones are, and whether you can use it with a few simple command calls.
For instance "logger" is clearly not a complex tool. If it had a little more functionality, the same interface would be very easy to use in a script (or program).
logger consists of about 3 lines of C code: openlog(facility); syslog(prio,text); closelog(); My imagined write2log() might be roughly the same: f=open(file,O_APPEND|O_WRONLY); write(f,buffer,snprintf(buffer,sizeof(buffer),"text", vars)); close(f);
Now if those libraries don't exist, you have a problem. A certain feature in the system ecosystem is missing.
If they don't exist, you have no option but to write them yourself. I don't see a problem here.
The question was whether they exist. Logrotation and asynchronous writing and all of that is not that easy to implement. Sure, if you spend a few hours to a few days on it, sure you might have something. The whole purpose of me asking was to help the OP (and myself) to see if something might not be missing here.
Okay, although there's virtually always room for improvement, writing to a log is a fairly simply thing in 99% of cases. The last 1% - I'm not sure what they might be, maybe it's about performance or response time when writing thousands of lines per second or some such. You or the OP would need to add your input here.
If every application writes its own logging framework, that's a lot of wasted effort.
Absolutely. I don't think that is what happens either. I think most applications use something like this: write(f,buffer,snprintf(buffer,sizeof(buffer),"text", vars)); possibly with a nice macro WRITE2LOG(prio,format,vars...).
Apparently you want me to start exploring the source of e.g. squid to see how it does it. I would think people would know about these answers.
No, actually I was interested in understanding which logging features you are missing. [snip - gobbledegook]
But if a solution currently does not exist it is also because of people who cannot understand that anyone would want it.
Often there is no solution when there is no problem. Sofar I believe you have failed to describe the problem. Or maybe I'm just too thick.
"And if existing syslogd and logrotate do not fit your purposes, then what?"
This question was clearly intended to open up the space where solutions could be found.
How can anyone propose a solution when you have not presented a problem?? All you said was "existing syslogd and logrotate do not fit my purposes". Please explain your purposes, otherwise we'll never get anywhere. -- Per Jessen, Zürich (6.1°C) http://www.dns24.ch/ - free dynamic DNS, made in Switzerland. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org