I am using Free Pascal (Lazarus) to develop a simple server daemon. The problem I am facing is that the TEventLog component does not write to the systemlog.
I use the following code:
EventLog1.LogType := ltSystem;
EventLog1.Active := True;
EventLog1.Log('Application has started!');
Instead of writing to systemlog it creates a file with the name as the executable and writes there.
Is there any other way I can write to the system log ? Is openlog defined in any unit I can use ?
(Assuming you use a *nix and the most recent 2.6.2 version).
No, libc log* functions seem only declared in the implementation of eventlog. Maybe they are in unit libc, but that is mostly unsupported, and linux/32bit only.
Check some assumptions:
Is active false before you set logtype, otherwise the active:=true might not recheck it.
you want to write system log, do you have enough privileges for that?
Do you see anything with strace/ktrace/truss ?
Related
I am working with a pwn question, and I want to debug v8 using gdb.
But in release version, I can not use job command.
And in a debug version, I will got abort when I called the function which is the main function in this pwn question.
And I have tried to change some #define code, but I failed.
And I tried to pass some compile args, I failed too.
So, how can I solve it?
For Release mode:
The job GDB macro should be functional if you add v8_enable_object_print = true to your args.gn (using gn args out/x64.release). Obviously, debugging a Release-mode binary will be a somewhat "interesting" experience.
For Debug mode:
Bypassing a DCHECK is easy: just comment it out and recompile.
And of course, if you find any bugs, please report them at crbug.com/v8/new :-)
I can't seem to find a solution to access a MySQL server from an Objective-C Mac OS project (which uses ARC).
I tried to use the MySQL framework that Sequel Pro provides, but that crashes (EXC_i386_GPFLT) my App whenever I just create a connection object:
SPMySQLConnection *conn = [[SPMySQLConnection alloc] init];
I don't know whether that is a bug in the framework or if I need to do something else in order to use it.
I tried a few other libraries (like MySqueakQl) but none of them are ARC compatible.
Also I tried to link to libmysqlclient.a directly, but if I copy that library into my project, I get a code signing error; if I just link to the .a in /usr/local/mysql/lib/, I get another error: dyld: Library not loaded: libmysqlclient.18.dylib ... Reason: image not found. I have to admit that I have zero experince with using third-party libraries (whether .a or .dylib) and probably didn't do it right.
I'm a bit surprised that there doesn't seem to be an up-to-date (read: working) solution out there. I know, consumer apps rather use Core Data, but I have to access out company database server.
Has anybody seen a solution (libary?) that works more or less "out of the box"? I'd be willing to pay for something that actually works.
A good tutorial on how to use .a libraries in Xcode projects that would also help me to understand where the dylib error comes from would also be very helpful.
Problem solved. I probably made some mistake when including the library.
The right steps to do this:
Drag the libmysqlclient.a library into your project window
Make sure you set Copy items if needed to Yes, and that it is added to your main target
Drag a folder containing the headers (found under /usr/local/mysql/include) into your project window
Again, make sure you set Copy items if needed to Yes and the correct target is checked.
Then:
#import "mysql.h"
- (BOOL) mySQLTest {
MYSQL connection;
mysql_init(&connection);
if(!mysql_real_connect(&connection,
[self.host UTF8String],
[self.user UTF8String],
[self.password UTF8String],
[self.database UTF8String],
self.port,
NULL,
0)) {
return NO;
}
// ... work with the DB
mysql_close(&connection);
return YES;
}
Works like a charm.
I have no idea why on my former attempts I got an error about the dylib; I never used it (only the static library).
The code signing issue may have been just a bug or one-time quirk in Xcode.
PROBLEM
Let's say I have a jenkins/hudson job (for example free-style) that takes two parameters PARAM_ONE and PARAM_TWO. Now, I do not know the values of those parameters, but I can run some script (perl/shell) to find values of those parameters and then I want the user to select from a dropdown list after which I can start the build.
Is there any way of doing that?
Sounds like you've found a plug-in that does what you need, that is pretty similar to the built-in Parameterized Builds functionality.
To answer your second question: when you define parameterized builds, the parameters are typically passed to your job as environment variables. So you'd access them however you access environment variables in your language, for instance, if you defined a parameter PARAM_ONE, you'd access it as:
In bash:
$PARAM_ONE
In Windows batch:
%PARAM_ONE%
In Python:
import os
os.getenv('PARAM_ONE')
etc.
I imagine this would be the same for the Extended Choice Parameter plugin you are using.
Just install this, and give the parameter in the build script like:
Windows
"your build script" %PARAMONE% %PARAMTWO%
In Java, you can access these parameters off the run object
EnvVars envVars = new EnvVars();
envVars = run.getEnvironment(listener);
for (String envName2 : envVars.keySet()) {
listener.getLogger().println(envName2 + " = " + envVars.get(envName2));
}
I installed the SetEnv plugin and it works fine for getting the variables during a task.
unfortunately when i try to use the env variable in the resulting status email I have no luck at all. Is this supposed to work?
I've tried both $VARNAME and ${VARNAME} - neither of which get replaced correctly in the email.
The simplest way to use environment variables (or any variables) in your email notifications is by using the Email-ext plugin.
Check their "Content token reference" for specifics but in short you get much more sophisticated substitution. Heres a few I use regularly:
${ENV, var} - Displays an environment
variable.
${BUILD_LOG_REGEX, regex, linesBefore, linesAfter, maxMatches, showTruncatedLines} - Displays lines from the build log that match the regular expression.
${CHANGES_SINCE_LAST_SUCCESS, reverse, format, showPaths, changesFormat, pathFormat} - Displays the changes since the last successful build.
${FAILED_TESTS} - Displays failing unit test information, if any tests have failed.
The plugin makes it easy to define a base "global" template in the Hudson configuration then sort of "extend" that template in your job configuration- adding additional detail. It also allows you to route notifications more granularly based on the build status/outcome.
This is possible already. It looks like you're using the wrong syntax. As mentioned previously, the email-ext plugin has a specific method for accessing environment variables. Try putting this in the email body instead:
${ENV, var=VARNAME}
An alternative method would be to use Hudson's execute shell feature to echo the environment variable during the build and parsing for it using BUILD_LOG_REGEX.
For example, you could have this in the Execute Shell part:
echo "Output: ${VARNAME}"
and parse it in the email using
${BUILD_LOG_REGEX, regex="^Output:", showTruncatedLines=false, substText=""}
It looks like I will have to wait for this:
http://wiki.hudson-ci.org/display/HUDSON/The+new+EMailer
I have a nice fully functioning module (wrtten using tcl/cpp) it works fine.
I want to use ramdebugger to debug scripts using that module
When I enter
load mylib.so
command1_from_lib xx
command2_from lib yy
If (say) command2 returns an error then ramdebugger dies
[paul#paul-es5 ramdebugger7.7.1]$ ./ramdebugger
alloc: invalid block: 0x999c058: 0 0
Aborted
It dies here in libtcl / ResetObjResult
if ((objResultPtr->bytes != NULL)
&& (objResultPtr->bytes != tclEmptyStringRep)) {
ckfree((char *) objResultPtr->bytes);
}
My suspicion is there is confusion over the global tclEmptyStringRep. I think the starkitted(?) ramdebugger has one and the dynamically loaded libtcl has a different one - the bytes pointer should logically be pointing to an empty string but the value there does not match what gdb shows for the global
I am a tcl noob and need any help I can get. Alternatively a suggestion for a different debugger would work
edit: fixed
Use tclStub to defer the link between the extension and the tcl runtime.
This sounds very much like a bug to me, as opposed to a question which this site can answer. You should contact the ramdebugger people to see if they can help.
However, for general Tcl debugging you could also see if the tools produced by ActiveState help; IIRC you can get a free trial to see if they can make any headway. (Myself, I'm of the put-lots-of-printf-calls in school of debugging, so I'm nobody's poster child.)