When the number of log outputs over a certain amount, the structure log output is suspended. The os_log_debug code runs without error, but the Xcode console has no output. When use OS_ACTIVITY_DT_MODE=1 turnoff structure log, the output is normal. Does structure log in Xcode 15 beta 6 has bugs, or the structure log has upper limit in Xcode console output ?
In Xcode 15 beta 6 console, structure log pause output when the number of log outputs over a certain amount.
In Xcode 15 beta 6
Have you tried this in the latest beta? That’s currently 15.0b8.
Does structure log in Xcode 15 beta 6 has bugs … ?
All large software has bugs |-:
Does … the structure log [have an] upper limit in Xcode console output?
There’s no documented limit to how many log entries Xcode 15 beta will accept.
Can you reproduce this in a small test project? That is:
-
Create a new project that logs a bunch of stuff.
-
Run it with Xcode 15 beta.
-
See whether it has the same issue as your main project.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
Hello, Eskimo. Thanks for your reply!
I reproduced the scene in the demo. When the length of each log is less than or equal to 815 bytes, the output is normal. Once it exceeds 815, such as 816, the output will pause at a certain log.
Outputs 90000 logs with length 815: ✅normal
Outputs 90000 logs with length 816: ❌ pause at 4968
Xcode version: beta-8
demo code:
#import "ViewController.h"
#import <os/log.h>
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
NSLog(@"%@", @"nslog output");
[self configSubViews];
// Each log's output is normal when length is less or eqult to 815
[self repeatRunOSLogTimes:90000 withLength:815];
}
- (void)configSubViews
{
UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
btn.backgroundColor = UIColor.redColor;
[self.view addSubview:btn];
btn.center = self.view.center;
[btn addTarget:self action:@selector(btnClick) forControlEvents:UIControlEventTouchUpInside];
}
- (void)btnClick
{
os_log(OS_LOG_DEFAULT, "btn click %s", [self randomStringWithLength:24].UTF8String);
}
- (void)repeatRunOSLogTimes:(NSInteger)runTimes
withLength:(NSInteger)len
{
for (int i = 0; i < runTimes; ++i) {
os_log(OS_LOG_DEFAULT, "%d", i+1);
os_log(OS_LOG_DEFAULT, "%s", [self randomStringWithLength:len].UTF8String);
}
}
- (NSString *)randomStringWithLength:(NSInteger)len {
NSString *letters = @"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
NSMutableString *randomString = [NSMutableString stringWithCapacity:len];
for (int i=0; i<len; i++) {
uint32_t length = (uint32_t)[letters length];
uint32_t randomIndex = arc4random_uniform(length);
[randomString appendFormat:@"%C", [letters characterAtIndex:randomIndex]];
}
return randomString;
}
@end
Weird. It’s definitely worth filing a bug about that. Please post your bug number, just for the record.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"