asl issue
asl issue
- Subject: asl issue
- From: Santosh Sinha <email@hidden>
- Date: Wed, 1 Jul 2009 21:54:53 +0530
we have create a asl file in "/Users/santoshs/Library/Logs/
MyAslFile.asl" and write a message ,after that delete the
system asl file , and try to read that message from own asl file but
can't read that message...
aslclient aslClient = asl_open("Error", "Self", ASL_OPT_STDERR);
int filedescriptor = open("/Users/santoshs/Library/Logs/
MyAslFile.log", O_WRONLY | O_CREAT | O_APPEND, 0644);
aslmsg msg = asl_new(ASL_TYPE_MSG);
int result = 0;
aslresponse r = NULL;
const char *key = NULL, *val = NULL;
if (filedescriptor != -1)
result = asl_add_log_file(aslClient, filedescriptor);
//Write...
asl_log(aslClient, msg, ASL_LEVEL_ERR, "test");
//Read...??
aslmsg resultMsg ;
resultMsg = asl_new(ASL_TYPE_QUERY);
asl_set_query(resultMsg, ASL_KEY_SENDER, "Error",
ASL_QUERY_OP_EQUAL);
r = asl_search(aslClient, resultMsg);
while (NULL != (resultMsg = aslresponse_next(r)))
{
for (int i = 0; (NULL != (key = asl_key(resultMsg, i))); i++)
{
val = asl_get(resultMsg, key);
}
}
//Free
asl_free(msg);
asl_free(resultMsg);
asl_close(aslClient);
aslresponse_free(r);
please help
Thanks
santosh
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden