diff --git a/cmdutils.c b/cmdutils.c
index 7e587de0ec8fc7966b53137fe5dfbbef734acf87..2d9a33dcddef5e228a4e3a517c789e45ee04b28c 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -991,7 +991,7 @@ static unsigned get_codecs_sorted(const AVCodecDescriptor ***rcodecs)
     while ((desc = avcodec_descriptor_next(desc)))
         nb_codecs++;
     if (!(codecs = av_calloc(nb_codecs, sizeof(*codecs)))) {
-        av_log(0, AV_LOG_ERROR, "Out of memory\n");
+        av_log(NULL, AV_LOG_ERROR, "Out of memory\n");
         exit(1);
     }
     desc = NULL;
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index 0baa3b17f725dcc3e33ccaed5dd2aa8c49ceee69..09b4aaf361601acac180a7f8ffd2da71a662f92d 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -2251,7 +2251,7 @@ static int opt_progress(void *optctx, const char *opt, const char *arg)
         arg = "pipe:";
     ret = avio_open2(&avio, arg, AVIO_FLAG_WRITE, &int_cb, NULL);
     if (ret < 0) {
-        av_log(0, AV_LOG_ERROR, "Failed to open progress URL \"%s\": %s\n",
+        av_log(NULL, AV_LOG_ERROR, "Failed to open progress URL \"%s\": %s\n",
                arg, av_err2str(ret));
         return ret;
     }
diff --git a/libavcodec/bink.c b/libavcodec/bink.c
index bcc6361c7ab9fbe093381c9925a58c2b946f0855..bb202ca60ab929bf659e0e13c9240a5c291f85d2 100644
--- a/libavcodec/bink.c
+++ b/libavcodec/bink.c
@@ -675,7 +675,7 @@ static int read_dct_coeffs(GetBitContext *gb, int32_t block[64], const uint8_t *
     } else {
         quant_idx = q;
         if (quant_idx > 15U) {
-            av_log(0, AV_LOG_ERROR, "quant_index %d out of range\n", quant_idx);
+            av_log(NULL, AV_LOG_ERROR, "quant_index %d out of range\n", quant_idx);
             return AVERROR_INVALIDDATA;
         }
     }
diff --git a/libavcodec/dsicinav.c b/libavcodec/dsicinav.c
index a1b45f194597c941184063fbf0c52b1639e36243..0290f5ab118263bce09e39fce8f8f679205ac7bd 100644
--- a/libavcodec/dsicinav.c
+++ b/libavcodec/dsicinav.c
@@ -212,7 +212,7 @@ static int cin_decode_rle(const unsigned char *src, int src_size, unsigned char
         } else {
             len = code + 1;
             if (len > src_end-src) {
-                av_log(0, AV_LOG_ERROR, "RLE overread\n");
+                av_log(NULL, AV_LOG_ERROR, "RLE overread\n");
                 return AVERROR_INVALIDDATA;
             }
             memcpy(dst, src, FFMIN(len, dst_end - dst));
diff --git a/libavcodec/iff.c b/libavcodec/iff.c
index c196cf6017842f0cfca231a85dde8e6a1dcb46cd..7fa0d52515edba8a56984fd4012488fa63ce13b8 100644
--- a/libavcodec/iff.c
+++ b/libavcodec/iff.c
@@ -372,7 +372,7 @@ static void decodeplane8(uint8_t *dst, const uint8_t *buf, int buf_size, int pla
 {
     const uint64_t *lut = plane8_lut[plane];
     if (plane >= 8) {
-        av_log(0, AV_LOG_WARNING, "Ignoring extra planes beyond 8\n");
+        av_log(NULL, AV_LOG_WARNING, "Ignoring extra planes beyond 8\n");
         return;
     }
     do {
diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c
index e74232ec5039c026f3c48762215f0578b0415120..030810c916de593a7cf84053497ced3f2036b2d6 100644
--- a/libavcodec/imgconvert.c
+++ b/libavcodec/imgconvert.c
@@ -643,12 +643,12 @@ int main(void){
             continue;
         }
         if (skip) {
-            av_log(0, AV_LOG_INFO, "%3d unused pixel format values\n", skip);
+            av_log(NULL, AV_LOG_INFO, "%3d unused pixel format values\n", skip);
             skip = 0;
         }
-        av_log(0, AV_LOG_INFO, "pix fmt %s yuv_plan:%d avg_bpp:%d colortype:%d\n", desc->name, is_yuv_planar(desc), av_get_padded_bits_per_pixel(desc), get_color_type(desc));
+        av_log(NULL, AV_LOG_INFO, "pix fmt %s yuv_plan:%d avg_bpp:%d colortype:%d\n", desc->name, is_yuv_planar(desc), av_get_padded_bits_per_pixel(desc), get_color_type(desc));
         if ((!(desc->flags & PIX_FMT_ALPHA)) != (desc->nb_components != 2 && desc->nb_components != 4)) {
-            av_log(0, AV_LOG_ERROR, "Alpha flag mismatch\n");
+            av_log(NULL, AV_LOG_ERROR, "Alpha flag mismatch\n");
             err = 1;
         }
     }
diff --git a/libavcodec/ivi_common.c b/libavcodec/ivi_common.c
index 6cb4ea274a6aea7afcd74522f17783319a3a74a5..c20ce77b3ba7caee2d87e8e3964b30b89ade97e3 100644
--- a/libavcodec/ivi_common.c
+++ b/libavcodec/ivi_common.c
@@ -311,7 +311,7 @@ av_cold int ff_ivi_init_tiles(IVIPlaneDesc *planes, int tile_width, int tile_hei
                         if (tile->num_MBs <= ref_tile->num_MBs) {
                             tile->ref_mbs = ref_tile->mbs;
                         }else
-                            av_log(0, AV_LOG_DEBUG, "Cannot use ref_tile, too few mbs\n");
+                            av_log(NULL, AV_LOG_DEBUG, "Cannot use ref_tile, too few mbs\n");
                         ref_tile++;
                     }
 
@@ -466,7 +466,7 @@ int ff_ivi_decode_blocks(GetBitContext *gb, IVIBandDesc *band, IVITile *tile)
                     col_flags[0] |= !!prev_dc;
                 }
                 if(band->transform_size > band->blk_size){
-                    av_log(0, AV_LOG_ERROR, "Too large transform\n");
+                    av_log(NULL, AV_LOG_ERROR, "Too large transform\n");
                     return AVERROR_INVALIDDATA;
                 }
                 /* apply inverse transform */
diff --git a/libavcodec/lzw.c b/libavcodec/lzw.c
index d06e3a0ce509ebb2d36f8deb1cbcb9f74f8f2419..97f6e6ac829cdb9f7fae23147b5a0cc23931cdf1 100644
--- a/libavcodec/lzw.c
+++ b/libavcodec/lzw.c
@@ -192,7 +192,7 @@ int ff_lzw_decode(LZWState *p, uint8_t *buf, int len){
                 goto the_end;
         }
         if (s->ebuf < s->pbuf) {
-            av_log(0, AV_LOG_ERROR, "lzw overread\n");
+            av_log(NULL, AV_LOG_ERROR, "lzw overread\n");
             goto the_end;
         }
         c = lzw_get_code(s);
diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c
index 8f7d34c2545261765e0d0bec5566a764c94ff071..dcd2f159b7333e627f248296cbe6fc43a3e0647a 100644
--- a/libavcodec/mpegaudiodec.c
+++ b/libavcodec/mpegaudiodec.c
@@ -268,7 +268,7 @@ static inline int l3_unscale(int value, int exponent)
     e -= exponent >> 2;
 #ifdef DEBUG
     if(e < 1)
-        av_log(0, AV_LOG_WARNING, "l3_unscale: e is %d\n", e);
+        av_log(NULL, AV_LOG_WARNING, "l3_unscale: e is %d\n", e);
 #endif
     if (e > 31)
         return 0;
diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c
index 892f96ff375f053fd1c05bc0b7bc456fa84009ce..4cf4b2f932e33ffc366af2bb31fa8cb91a75f56b 100644
--- a/libavcodec/qdm2.c
+++ b/libavcodec/qdm2.c
@@ -347,7 +347,7 @@ static int qdm2_get_vlc (GetBitContext *gb, VLC *vlc, int flag, int depth)
         int tmp;
 
         if (value >= 60) {
-            av_log(0, AV_LOG_ERROR, "value %d in qdm2_get_vlc too large\n", value);
+            av_log(NULL, AV_LOG_ERROR, "value %d in qdm2_get_vlc too large\n", value);
             return 0;
         }
 
@@ -1360,7 +1360,7 @@ static void qdm2_fft_decode_tones (QDM2Context *q, int duration, GetBitContext *
             while ((n = qdm2_get_vlc(gb, &vlc_tab_fft_tone_offset[local_int_8], 1, 2)) < 2) {
                 if (get_bits_left(gb)<0) {
                     if(local_int_4 < q->group_size)
-                        av_log(0, AV_LOG_ERROR, "overread in qdm2_fft_decode_tones()\n");
+                        av_log(NULL, AV_LOG_ERROR, "overread in qdm2_fft_decode_tones()\n");
                     return;
                 }
                 offset = 1;
diff --git a/libavfilter/avcodec.c b/libavfilter/avcodec.c
index 30b8258eb65c0bcdf7d9812da94b0af237af0d45..688f1b397aaeda68ea9862403f1c966856b60f0f 100644
--- a/libavfilter/avcodec.c
+++ b/libavfilter/avcodec.c
@@ -62,7 +62,7 @@ int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src)
         dst->audio->channel_layout      = src->channel_layout;
         dst->audio->channels            = src->channels;
         if(src->channels < av_get_channel_layout_nb_channels(src->channel_layout)) {
-            av_log(0, AV_LOG_ERROR, "libavfilter does not support this channel layout\n");
+            av_log(NULL, AV_LOG_ERROR, "libavfilter does not support this channel layout\n");
             return AVERROR(EINVAL);
         }
         break;
diff --git a/libavfilter/formats.c b/libavfilter/formats.c
index be69a1a3df6ff2d3dffb8acf776477e0db5b7814..ea9a184eaac5101a38beca05d6f88b890f384a0d 100644
--- a/libavfilter/formats.c
+++ b/libavfilter/formats.c
@@ -69,7 +69,7 @@ do {
             for (j = 0; j < b->nb; j++)                                         \
                 if (a->fmts[i] == b->fmts[j]) {                                 \
                     if(k >= FFMIN(a->nb, b->nb)){                               \
-                        av_log(0, AV_LOG_ERROR, "Duplicate formats in avfilter_merge_formats() detected\n"); \
+                        av_log(NULL, AV_LOG_ERROR, "Duplicate formats in avfilter_merge_formats() detected\n"); \
                         av_free(ret->fmts);                                     \
                         av_free(ret);                                           \
                         return NULL;                                            \
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 61ba6ec2d61fa1b1db41bbc7aeccc886d0f0aae8..d37346b47e2f5fd8fc61bda6b38be5528b5782d4 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1062,7 +1062,7 @@ static int matroska_decode_buffer(uint8_t** buf, int* buf_size,
         uint8_t *header = encodings[0].compression.settings.data;
 
         if (header_size && !header) {
-            av_log(0, AV_LOG_ERROR, "Compression size but no data in headerstrip\n");
+            av_log(NULL, AV_LOG_ERROR, "Compression size but no data in headerstrip\n");
             return -1;
         }
 
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 400623149c302cc874a2a6b62ecec868010ecabe..2f22571057727b7409820d67cc9180fefd229d16 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -237,7 +237,7 @@ int ffio_limit(AVIOContext *s, int size)
         }
 
         if(s->maxsize>=0 && remaining+1 < size){
-            av_log(0, remaining ? AV_LOG_ERROR : AV_LOG_DEBUG, "Truncating packet of size %d to %"PRId64"\n", size, remaining+1);
+            av_log(NULL, remaining ? AV_LOG_ERROR : AV_LOG_DEBUG, "Truncating packet of size %d to %"PRId64"\n", size, remaining+1);
             size= remaining+1;
         }
     }
@@ -547,7 +547,7 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputForma
     if (!s && !(s = avformat_alloc_context()))
         return AVERROR(ENOMEM);
     if (!s->av_class){
-        av_log(0, AV_LOG_ERROR, "Input context has not been properly allocated by avformat_alloc_context() and is not NULL either\n");
+        av_log(NULL, AV_LOG_ERROR, "Input context has not been properly allocated by avformat_alloc_context() and is not NULL either\n");
         return AVERROR(EINVAL);
     }
     if (fmt)
diff --git a/libavutil/imgutils.c b/libavutil/imgutils.c
index b946d6dc0c55a1d1bd4bec6f0ccff70c328541ab..8595ba1bbfacba788171858a9f640c130161b29b 100644
--- a/libavutil/imgutils.c
+++ b/libavutil/imgutils.c
@@ -277,7 +277,7 @@ void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4],
             int h = height;
             int bwidth = av_image_get_linesize(pix_fmt, width, i);
             if (bwidth < 0) {
-                av_log(0, AV_LOG_ERROR, "av_image_get_linesize failed\n");
+                av_log(NULL, AV_LOG_ERROR, "av_image_get_linesize failed\n");
                 return;
             }
             if (i == 1 || i == 2) {
diff --git a/libavutil/rational.c b/libavutil/rational.c
index 0fb855a46d7c670d4e1b1b2f9e9a81d1b3277a8f..768f2524c77846845babdc5fe2b910eb1d519cd3 100644
--- a/libavutil/rational.c
+++ b/libavutil/rational.c
@@ -160,11 +160,11 @@ int main(void)
                     else if (d < 0)  d = -1;
                     else if (d != d) d = INT_MIN;
                     if (c != d)
-                        av_log(0, AV_LOG_ERROR, "%d/%d %d/%d, %d %f\n", a.num,
+                        av_log(NULL, AV_LOG_ERROR, "%d/%d %d/%d, %d %f\n", a.num,
                                a.den, b.num, b.den, c,d);
                     r = av_sub_q(av_add_q(b,a), b);
                     if(b.den && (r.num*a.den != a.num*r.den || !r.num != !a.num || !r.den != !a.den))
-                        av_log(0, AV_LOG_ERROR, "%d/%d ", r.num, r.den);
+                        av_log(NULL, AV_LOG_ERROR, "%d/%d ", r.num, r.den);
                 }
             }
         }