How to debug server errors by adding logging details?

System Information
  • Strapi Version: 4.3.0.beta-2
  • Operating System: Win 10 pro 64
  • Database: postgres
  • Node Version: 16.14.2
  • NPM Version: 8.7.0
  • Yarn Version: 1.22.0

Hi there, I have two issues:

  1. Getting more logging data to debug problems.
  2. How to resolve an undefined type for a content type imported from v3.

Currently using v4.3.0.beta-2. I’m getting an error when I try to change a content type using the admin area in develop mode. It just says ‘warning: an error occured’. I get nothing in the console except the PUT request (I’m editing an existing item imported from V3, it has a property with an undefined type).

I have this config, setup to provide debug logging:

config/middlewares.ts


‘strapi::poweredBy’,
{
name: ‘strapi::logger’,
config: {
level: ‘debug’,
}
},
‘strapi::query’,

.env

STRAPI_LOG_LEVEL=DEBUG

…and even a config/logger.ts

‘use strict’;

const {
winston,
formats: { prettyPrint, levelFilter },
} = require(’@strapi/logger’);

module.exports = {
transports: [
new winston.transports.Console({
level: ‘http’,
format: winston.format.combine(
levelFilter(‘http’),
prettyPrint({ timestamps: ‘YYYY-MM-DD hh:mm:ss.SSS’ })
),
}),
],
};

I’m going to try some things to fix error no.2, but it would be REALLY handy to get some clarification on how to get more info back from the logging.
I’ve tried all 3 settings above, separately and all together, but nothing changes the console output. I still just get this:

http: PUT /content-type-builder/components/seo.seo (43 ms) 400


1 Like

I’ve resolved the undefined types (which were incorrectly migrated from v3 AFAICT), but I still can’t figure out what the right way to get details logs back from the server when HTTP requests fail with 400/500s.

FWIW, I resolved the undefined types issue by manually editing the schemas in collections, components and suchlike using the schemas generated by creating new, similar items with the admin interface.