Next 13 + Vercel (+ axiom?), how to log?

I have looked at theo's video about logging and Axiom but I cant get to have working logging on a sample nextjs 13 app. src/app/api/foo/route.ts
import { NextResponse } from "next/server";

export async function GET() {
const data = {
message: "Hello World",
};
console.log({ ...data, type: "log" });
console.info({ ...data, type: "info" });
console.warn({ ...data, type: "warn" });
console.debug({ ...data, type: "debug" });
console.trace({ ...data, type: "trace" });

return NextResponse.json(data);
}
import { NextResponse } from "next/server";

export async function GET() {
const data = {
message: "Hello World",
};
console.log({ ...data, type: "log" });
console.info({ ...data, type: "info" });
console.warn({ ...data, type: "warn" });
console.debug({ ...data, type: "debug" });
console.trace({ ...data, type: "trace" });

return NextResponse.json(data);
}
I do received build logs on axiom with the pre-generated route page that has all the logs (cf. screenshot) but that's it, the logs only show then and there, not when I access .../api/foo, logs do show locally, but NOT on vercel/axiom. Any ideas please? it was floated that logging doesnt work on free plan but I couldnt find any proof of that...
1 Reply
Shoodey
Shoodey•12mo ago
Kind bump on this 😊