Log file not generated with SFAuthorizationPluginView

I am trying to create a custom logger for using it inside NameAndPassword Plugin https://github.com/skycocker/NameAndPassword
Log file not getting generated with SFAuthorizationPluginView

Have tried libraries like: Log4swift, CocoaLumberjack and also followed below link

https://stackoverflow.com/questions/7271528/how-to-nslog-into-a-file
override NSLog with a custom function using a macro. Example, add this class to your project:

// file Log.h
#define NSLog(args...) _Log(@"DEBUG ", _

FILE_,LINE,PRETTY_FUNCTION,args);
@interface Log : NSObject
void _Log(NSString *prefix, const char *file, int lineNumber, const char *funcName, NSString *format,...);
@EnD

// file Log.m
#import "Log.h"
@implementation Log
void _Log(NSString *prefix, const char *file, int lineNumber, const char *funcName, NSString *format,...) {
va_list ap;
va_start (ap, format);
format = [format stringByAppendingString:@"\n"];
NSString *msg = [[NSString alloc] initWithFormat:[NSString stringWithFormat:@"%@",format] arguments:ap];
va_end (ap);
fprintf(stderr,"%s%50s:%3d - %s",[prefix UTF8String], funcName, lineNumber, [msg UTF8String]);
[msg release];
}
@EnD
Issue:

It is a .bundle project which is invoked on system login. Log file is not getting generated and no error.
Also, noticed that using NSLog generates system log but only during sleep & lock/unlock mode, not in Login mode
Have someone faced this issue before?

Replies

An authorisation function should log using the system logging facility, which is currently <os/log.h>. One you do that, you can view your log messages in real time by SSH’ing into the machine and running the

log
command-line tool.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

And is there is a way to do logging in the file for a non-priveleged authorization plugin? I've tried different folders and put plugin after HomeDirMechanism completes, but I still get a permissions error when I'm trying to save a log file. We have os.log in place but also wanted to add a simple file log for internal purposes.