For N >= 3 and p is an element of(1, N), we look for g is an element of L-loc(1)(R-N) such that the following weighted logarithmic Sobolev inequality: integral g vertical bar u vertical bar(p) log vertical bar(p) dx <= gamma log ( C(g,gamma integral(RN) vertical bar del u vertical bar(p) dx), holds true for all u is an element of D-0(1,p)( R-N) with integral(RN) g vertical bar u vertical bar(p) dx = 1, for some gamma, C( g,gamma) > 0. For each r is an element of(p, Np/N-p], we identify a Banach function space H-p,H-r(R-N) such that the above inequality holds for g is an element of H-p,H-r(R-N). For gamma > r/r-p, we also find a class of gfor which the best constant C( g,gamma) in the above inequality is attained in D-0(1,p) (R-N). Further, for a closed set Ewith Assouad dimension = d < N and a is an element of (-(N-d)(p-1)/p, (N-p)(N-d)/Np), we establish the following logarithmic Hardy inequality integral(RN) vertical bar u vertical bar(p)/delta(p(a+1))(E) log (delta(N-P-Pa vertical bar)(E)u vertical bar(p)) dx <= N/P log (c integral(RN) vertical bar del u vertical bar(p)/delta(pa)(E) dx), for all u is an element of C-c(infinity)(R-N) with integral(RN)vertical bar u vertical bar(p)/delta(p(a+1))(E) dx - 1, for some C > 0, where delta(E)(x) in the distance between x and E. The second order extension of the logarithmic Hardy inequality is also obtained. (C) 2020 Elsevier Inc. All rights reserved.